Updated to a newer version of NuGet

- Update the newest nuget
- Filter out build dependencies from the project resolver based on hte lock file
- Fix more erroneous build dependencies
This commit is contained in:
David Fowler 2016-02-15 18:39:29 -08:00
parent c9cf2585a0
commit 129442923a
8 changed files with 26 additions and 23 deletions

View file

@ -175,7 +175,7 @@ namespace Microsoft.DotNet.ProjectModel
var libraries = new Dictionary<LibraryKey, LibraryDescription>();
var projectResolver = new ProjectDependencyProvider(ProjectResolver);
var mainProject = projectResolver.GetDescription(TargetFramework, Project);
var mainProject = projectResolver.GetDescription(TargetFramework, Project, targetLibrary: null);
// Add the main project
libraries.Add(new LibraryKey(mainProject.Identity.Name), mainProject);

View file

@ -27,7 +27,7 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
var project = _resolveProject(Path.GetDirectoryName(path));
if (project != null)
{
return GetDescription(targetLibrary.TargetFramework, project);
return GetDescription(targetLibrary.TargetFramework, project, targetLibrary);
}
else
{
@ -40,30 +40,40 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
return GetDescription(name, path, targetLibrary, projectCacheResolver: null);
}
public ProjectDescription GetDescription(NuGetFramework targetFramework, Project project)
public ProjectDescription GetDescription(NuGetFramework targetFramework, Project project, LockFileTargetLibrary targetLibrary)
{
// This never returns null
var targetFrameworkInfo = project.GetTargetFramework(targetFramework);
var targetFrameworkDependencies = new List<LibraryRange>(targetFrameworkInfo.Dependencies);
var dependencies = new List<LibraryRange>(targetFrameworkInfo.Dependencies);
if (targetFramework != null && targetFramework.IsDesktop())
{
targetFrameworkDependencies.Add(new LibraryRange("mscorlib", LibraryType.ReferenceAssembly, LibraryDependencyType.Build));
dependencies.Add(new LibraryRange("mscorlib", LibraryType.ReferenceAssembly, LibraryDependencyType.Build));
targetFrameworkDependencies.Add(new LibraryRange("System", LibraryType.ReferenceAssembly, LibraryDependencyType.Build));
dependencies.Add(new LibraryRange("System", LibraryType.ReferenceAssembly, LibraryDependencyType.Build));
if (targetFramework.Version >= new Version(3, 5))
{
targetFrameworkDependencies.Add(new LibraryRange("System.Core", LibraryType.ReferenceAssembly, LibraryDependencyType.Build));
dependencies.Add(new LibraryRange("System.Core", LibraryType.ReferenceAssembly, LibraryDependencyType.Build));
if (targetFramework.Version >= new Version(4, 0))
{
targetFrameworkDependencies.Add(new LibraryRange("Microsoft.CSharp", LibraryType.ReferenceAssembly, LibraryDependencyType.Build));
dependencies.Add(new LibraryRange("Microsoft.CSharp", LibraryType.ReferenceAssembly, LibraryDependencyType.Build));
}
}
}
var dependencies = project.Dependencies.Concat(targetFrameworkDependencies).ToList();
// Add all of the project's dependencies
dependencies.AddRange(project.Dependencies);
if (targetLibrary != null)
{
// The lock file entry might have a filtered set of dependencies
var lockFileDependencies = targetLibrary.Dependencies.ToDictionary(d => d.Id);
// Remove all non-framework dependencies that don't appear in the lock file entry
dependencies.RemoveAll(m => !lockFileDependencies.ContainsKey(m.Name) && m.Target != LibraryType.ReferenceAssembly);
}
// Mark the library as unresolved if there were specified frameworks
// and none of them resolved

View file

@ -6,7 +6,7 @@
"description": "Types to model a .NET Project",
"dependencies": {
"System.Reflection.Metadata": "1.2.0-rc3-23811",
"NuGet.Packaging": "3.4.0-beta-583",
"NuGet.Packaging": "3.4.0-beta-625",
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996",
"Microsoft.Extensions.JsonParser.Sources": {
"type": "build",

View file

@ -24,7 +24,7 @@
"Microsoft.CodeAnalysis.CSharp": "1.2.0-beta1-20160202-02",
"Microsoft.DiaSymReader.Native": "1.3.3",
"NuGet.CommandLine.XPlat": "3.4.0-beta-583",
"NuGet.CommandLine.XPlat": "3.4.0-beta-625",
"System.CommandLine": "0.1.0-e160119-1",
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
@ -47,10 +47,7 @@
"version": "1.0.0-rc2-16453",
"type": "build"
},
"Microsoft.Extensions.Testing.Abstractions": {
"version": "1.0.0-*",
"type": "build"
},
"Microsoft.Extensions.Testing.Abstractions": "1.0.0-*",
"Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23811",
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23811",
"NETStandard.Library": "1.0.0-rc2-23811",

View file

@ -6,8 +6,7 @@
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
"Microsoft.DotNet.Cli.Utils": {
"target": "project",
"type": "build"
"target": "project"
},
"xunit": "2.1.0",

View file

@ -6,8 +6,7 @@
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
"Microsoft.DotNet.Cli.Utils": {
"target": "project",
"type": "build"
"target": "project"
},
"xunit": "2.1.0",

View file

@ -5,8 +5,7 @@
"NETStandard.Library": "1.0.0-rc2-23811",
"Microsoft.DotNet.Cli.Utils": {
"target": "project",
"type": "build"
"target": "project"
},
"dotnet": { "target": "project" },

View file

@ -6,8 +6,7 @@
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
"Microsoft.DotNet.Cli.Utils": {
"target": "project",
"type": "build"
"target": "project"
},
"xunit": "2.1.0",