Fixing windows test breaks. It was because of how the NuGet API is putting Directory Separators in the lock file. They always normalize them to forward slash.

This commit is contained in:
Livar Cunha 2016-09-27 10:51:57 -07:00
parent 2ea227e388
commit d7e00907e0
4 changed files with 9 additions and 4 deletions

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.Tools.Common;
using NuGet.Packaging;
using NuGet.ProjectModel;
@ -50,7 +51,7 @@ namespace Microsoft.DotNet.Cli.Utils
var packageDirectory = new VersionFolderPathResolver(nugetPackagesRoot)
.GetInstallPath(toolLibrary.Name, toolLibrary.Version);
var filePath = Path.Combine(packageDirectory, runtimeAssembly.Path);
var filePath = Path.Combine(packageDirectory, PathUtility.GetPathWithDirectorySeparator(runtimeAssembly.Path));
return filePath;
}

View file

@ -14,7 +14,7 @@
"Microsoft.DotNet.Files": {
"target": "project"
},
"NuGet.ProjectModel": "3.6.0-beta.1.msbuild.15"
"NuGet.ProjectModel": "3.6.0-beta.1.msbuild.16"
},
"frameworks": {
"net451": {

View file

@ -406,6 +406,7 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
return package
.PackageLibrary
.Files
.Select(f => PathUtility.GetPathWithDirectorySeparator(f))
.Where(path => path.StartsWith("shared" + Path.DirectorySeparatorChar))
.Select(path => LibraryAsset.CreateFromRelativePath(package.Path, path));
}
@ -415,7 +416,8 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
var analyzers = package
.PackageLibrary
.Files
.Where(path => path.StartsWith("analyzers" + LockFile.DirectorySeparatorChar) &&
.Select(f => PathUtility.GetPathWithDirectorySeparator(f))
.Where(path => path.StartsWith("analyzers" + Path.DirectorySeparatorChar) &&
path.EndsWith(".dll"));

View file

@ -42,6 +42,7 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
// If a NuGet dependency is supposed to provide assemblies but there is no assembly compatible with
// current target framework, we should mark this dependency as unresolved
var containsAssembly = package.Files
.Select(f => f.Replace('/', Path.DirectorySeparatorChar))
.Any(x => x.StartsWith($"ref{Path.DirectorySeparatorChar}") ||
x.StartsWith($"lib{Path.DirectorySeparatorChar}"));
@ -50,7 +51,8 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
targetLibrary.RuntimeAssemblies.Any() ||
!containsAssembly;
var dependencies = new List<ProjectLibraryDependency>(targetLibrary.Dependencies.Count + targetLibrary.FrameworkAssemblies.Count);
var dependencies =
new List<ProjectLibraryDependency>(targetLibrary.Dependencies.Count + targetLibrary.FrameworkAssemblies.Count);
PopulateDependencies(dependencies, targetLibrary, targetFramework);
var path = _packagePathResolver?.GetPackageDirectory(package.Name, package.Version);