2016-09-27 16:11:16 -07:00
|
|
|
using System.Linq;
|
|
|
|
using Microsoft.Build.Construction;
|
|
|
|
using Microsoft.DotNet.ProjectJsonMigration;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Tools.Migrate
|
|
|
|
{
|
|
|
|
public static class ProjectRootElementExtensions
|
|
|
|
{
|
|
|
|
public static string GetSdkVersion(this ProjectRootElement projectRootElement)
|
|
|
|
{
|
2016-10-03 20:10:09 -07:00
|
|
|
return projectRootElement
|
|
|
|
.Items
|
|
|
|
.Where(i => i.ItemType == "PackageReference")
|
2016-10-31 11:00:43 -07:00
|
|
|
.First(i => i.Include == PackageConstants.SdkPackageName)
|
2016-10-03 20:10:09 -07:00
|
|
|
.GetMetadataWithName("version").Value;
|
2016-09-27 16:11:16 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|