Fixed netcore50 package based frameworks (#2630)

This commit is contained in:
Pavel Krymets 2016-04-21 21:47:20 -07:00 committed by David Fowler
parent 3d8cbba932
commit c8fb6c26c3
4 changed files with 29 additions and 2 deletions

View file

@ -8,6 +8,11 @@
"Microsoft.NETCore.App": "1.0.0-rc2-*"
}
},
"netcore50": {
"dependencies": {
"System.Private.Uri": "4.0.1-rc2-24018"
}
},
"net99": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-rc2-24018"

View file

@ -380,7 +380,7 @@ namespace Microsoft.DotNet.ProjectModel
if (package != null &&
package.Resolved &&
package.HasCompileTimePlaceholder &&
!TargetFramework.IsPackageBased)
!TargetFramework.IsPackageBased())
{
var newKey = new LibraryKey(library.Identity.Name, LibraryType.ReferenceAssembly);
var dependency = new LibraryRange(library.Identity.Name, LibraryType.ReferenceAssembly);

View file

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Linq;
using System;
using System.Runtime.Versioning;
namespace NuGet.Frameworks
@ -56,5 +56,12 @@ namespace NuGet.Frameworks
}
return name + "-" + frameworkName.Profile;
}
public static bool IsPackageBased(this NuGetFramework self)
{
return self.IsPackageBased ||
(self.Framework == FrameworkConstants.FrameworkIdentifiers.NetCore &&
self.Version >= new Version(5, 0, 0, 0));
}
}
}

View file

@ -76,7 +76,22 @@ namespace Microsoft.DotNet.ProjectModel.Tests
.WithTargetFramework("net99")
.Build();
// Will fail with dupes if any
context.LibraryManager.GetLibraries().ToDictionary(l => l.Identity.Name);
}
[Fact]
public void NetCore50ShouldNotResolveFrameworkAssemblies()
{
var instance = TestAssetsManager.CreateTestInstance("TestMicrosoftCSharpReferenceMissingFramework")
.WithLockFiles();
var context = new ProjectContextBuilder().WithProjectDirectory(instance.TestRoot)
.WithTargetFramework("netcore50")
.Build();
var diagnostics = context.LibraryManager.GetAllDiagnostics();
Assert.False(diagnostics.Any(d => d.ErrorCode == ErrorCodes.DOTNET1011));
}
}
}