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">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.Sdk">
<Version>1.0.0-alpha-20161007-1</Version>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161010-1</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -43,7 +43,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
new PackageDependencyInfo
{
Name = ConstantPackageNames.CSdkPackageName,
Version = migrationSettings.SdkPackageVersion
Version = migrationSettings.SdkPackageVersion,
PrivateAssets = "All"
}), migrationRuleInputs.CommonItemGroup);
// Migrate Direct Deps first
@ -141,7 +142,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
transform = PackageDependencyTransform();
if (packageDependency.Type == LibraryDependencyType.Build)
{
transform = transform.WithMetadata("PrivateAssets", "all");
transform = transform.WithMetadata("PrivateAssets", "All");
}
else if (packageDependency.SuppressParent != LibraryIncludeFlagUtils.DefaultSuppressParent)
{
@ -228,7 +229,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
dep => dep.Name,
dep => "",
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>(
"DotNetCliToolReference",
@ -247,6 +249,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
{
public string Name {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;
}
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;
}
@ -104,7 +104,10 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
foreach (var metadata in _metadata)
{
item.AddMetadata(metadata.MetadataName, metadata.GetMetadataValue(source));
if (metadata.ShouldWriteMetadata(source))
{
item.AddMetadata(metadata.MetadataName, metadata.GetMetadataValue(source));
}
}
return item;

View file

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