Update Microsoft.NETCore.Sdk => Microsoft.NET.Sdk.

This commit is contained in:
Eric Erhardt 2016-10-10 14:04:30 -05:00
parent 2727b191e3
commit 633b56e448
10 changed files with 33 additions and 17 deletions

View file

@ -16,8 +16,9 @@
<PackageReference Include="Microsoft.NETCore.App"> <PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.1</Version> <Version>1.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NETCore.Sdk"> <PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161007-1</Version> <Version>1.0.0-alpha-20161010-1</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>

View file

@ -3,7 +3,7 @@
"frameworks": { "frameworks": {
"netstandard1.5": { "netstandard1.5": {
"dependencies": { "dependencies": {
"Microsoft.NETCore.Sdk": "1.0.0-alpha-20160923-4", "Microsoft.NET.Sdk": "1.0.0-alpha-20161010-1",
"NETStandard.Library": "1.6.0" "NETStandard.Library": "1.6.0"
} }
} }

View file

@ -3,7 +3,7 @@
"frameworks": { "frameworks": {
"netstandard1.5": { "netstandard1.5": {
"dependencies": { "dependencies": {
"Microsoft.NETCore.Sdk": "1.0.0-alpha-20160923-4", "Microsoft.NET.Sdk": "1.0.0-alpha-20161010-1",
"NETStandard.Library": "1.6.0" "NETStandard.Library": "1.6.0"
} }
} }

View file

@ -3,7 +3,7 @@
"frameworks": { "frameworks": {
"netstandard1.5": { "netstandard1.5": {
"dependencies": { "dependencies": {
"Microsoft.NETCore.Sdk": "1.0.0-alpha-20160923-4", "Microsoft.NET.Sdk": "1.0.0-alpha-20161010-1",
"NETStandard.Library": "1.6.0" "NETStandard.Library": "1.6.0"
} }
} }

View file

@ -17,8 +17,9 @@
<PackageReference Include="Microsoft.NETCore.App"> <PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.1</Version> <Version>1.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NETCore.Sdk"> <PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161007-1</Version> <Version>1.0.0-alpha-20161010-1</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="MSTest.TestAdapter"> <PackageReference Include="MSTest.TestAdapter">
<Version>1.0.3-preview</Version> <Version>1.0.3-preview</Version>

View file

@ -5,6 +5,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration
{ {
public class ConstantPackageNames public class ConstantPackageNames
{ {
public const string CSdkPackageName = "Microsoft.NETCore.Sdk"; public const string CSdkPackageName = "Microsoft.NET.Sdk";
} }
} }

View file

@ -11,6 +11,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Models
private readonly string _metadataValue; private readonly string _metadataValue;
private readonly Func<T, string> _metadataValueFunc; private readonly Func<T, string> _metadataValueFunc;
private readonly Func<T, bool> _writeMetadataFunc;
public ItemMetadataValue(string metadataName, string metadataValue) public ItemMetadataValue(string metadataName, string metadataValue)
{ {
@ -18,10 +19,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Models
_metadataValue = metadataValue; _metadataValue = metadataValue;
} }
public ItemMetadataValue(string metadataName, Func<T, string> metadataValueFunc) public ItemMetadataValue(string metadataName, Func<T, string> metadataValueFunc, Func<T, bool> writeMetadataFunc = null)
{ {
MetadataName = metadataName; MetadataName = metadataName;
_metadataValueFunc = metadataValueFunc; _metadataValueFunc = metadataValueFunc;
_writeMetadataFunc = writeMetadataFunc;
}
public bool ShouldWriteMetadata(T source)
{
return _writeMetadataFunc == null || _writeMetadataFunc(source);
} }
public string GetMetadataValue(T source) public string GetMetadataValue(T source)

View file

@ -43,7 +43,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
new PackageDependencyInfo new PackageDependencyInfo
{ {
Name = ConstantPackageNames.CSdkPackageName, Name = ConstantPackageNames.CSdkPackageName,
Version = migrationSettings.SdkPackageVersion Version = migrationSettings.SdkPackageVersion,
PrivateAssets = "All"
}), migrationRuleInputs.CommonItemGroup); }), migrationRuleInputs.CommonItemGroup);
// Migrate Direct Deps first // Migrate Direct Deps first
@ -141,7 +142,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
transform = PackageDependencyTransform(); transform = PackageDependencyTransform();
if (packageDependency.Type == LibraryDependencyType.Build) if (packageDependency.Type == LibraryDependencyType.Build)
{ {
transform = transform.WithMetadata("PrivateAssets", "all"); transform = transform.WithMetadata("PrivateAssets", "All");
} }
else if (packageDependency.SuppressParent != LibraryIncludeFlagUtils.DefaultSuppressParent) else if (packageDependency.SuppressParent != LibraryIncludeFlagUtils.DefaultSuppressParent)
{ {
@ -228,7 +229,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
dep => dep.Name, dep => dep.Name,
dep => "", dep => "",
dep => true) dep => true)
.WithMetadata("Version", r => r.Version); .WithMetadata("Version", r => r.Version)
.WithMetadata("PrivateAssets", r => r.PrivateAssets, r => !string.IsNullOrEmpty(r.PrivateAssets));
private AddItemTransform<ProjectLibraryDependency> ToolTransform => new AddItemTransform<ProjectLibraryDependency>( private AddItemTransform<ProjectLibraryDependency> ToolTransform => new AddItemTransform<ProjectLibraryDependency>(
"DotNetCliToolReference", "DotNetCliToolReference",
@ -247,6 +249,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
{ {
public string Name {get; set;} public string Name {get; set;}
public string Version {get; set;} public string Version {get; set;}
public string PrivateAssets {get; set;}
} }
} }
} }

View file

@ -82,9 +82,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
return this; return this;
} }
public AddItemTransform<T> WithMetadata(string metadataName, Func<T, string> metadataValueFunc) public AddItemTransform<T> WithMetadata(string metadataName, Func<T, string> metadataValueFunc, Func<T, bool> writeMetadataFunc = null)
{ {
_metadata.Add(new ItemMetadataValue<T>(metadataName, metadataValueFunc)); _metadata.Add(new ItemMetadataValue<T>(metadataName, metadataValueFunc, writeMetadataFunc));
return this; return this;
} }
@ -103,9 +103,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
item.Exclude = excludeValue; item.Exclude = excludeValue;
foreach (var metadata in _metadata) foreach (var metadata in _metadata)
{
if (metadata.ShouldWriteMetadata(source))
{ {
item.AddMetadata(metadata.MetadataName, metadata.GetMetadataValue(source)); item.AddMetadata(metadata.MetadataName, metadata.GetMetadataValue(source));
} }
}
return item; return item;
} }

View file

@ -16,8 +16,9 @@
<PackageReference Include="Microsoft.NETCore.App"> <PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.1</Version> <Version>1.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NETCore.Sdk"> <PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161007-1</Version> <Version>1.0.0-alpha-20161010-1</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>