Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/NuGet.BuildTasks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Ayewah <natidea@users.noreply.github.com>2017-09-07 05:03:34 +0300
committerGitHub <noreply@github.com>2017-09-07 05:03:34 +0300
commit89ff0d269b4688c1189933597b3fa24c12807f33 (patch)
tree6b02e299468cd1be532226afd754dfb777af3ef4
parent057af5b6ff9521551cf6dcee5cd737993a943472 (diff)
parentb279041f6a06b8c8df174625b07b833ae7862f20 (diff)
Merge pull request #37 from NuGet/natidea-merge-dev15.1
Port changes in dev15.1 back to dev
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs29
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx3
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Json/ProjectDependency.assets.json213
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj1
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/PackageFolderTests.cs2
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs11
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.Build.Tasks.csproj2
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets1
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/NuGetPackageObject.cs1
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs80
10 files changed, 323 insertions, 20 deletions
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs
index eeed7e7..f0345cb 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs
@@ -233,6 +233,35 @@ namespace Microsoft.NuGet.Build.Tasks.Tests.Json {
/// <summary>
/// Looks up a localized string similar to {
+ /// &quot;version&quot;: 2,
+ /// &quot;targets&quot;: {
+ /// &quot;.NETFramework,Version=v4.5.2&quot;: {
+ /// &quot;log4net/2.0.7&quot;: {
+ /// &quot;type&quot;: &quot;package&quot;,
+ /// &quot;compile&quot;: {
+ /// &quot;lib/net45-full/log4net.dll&quot;: {}
+ /// },
+ /// &quot;runtime&quot;: {
+ /// &quot;lib/net45-full/log4net.dll&quot;: {}
+ /// }
+ /// },
+ /// &quot;Newtonsoft.Json/9.0.1&quot;: {
+ /// &quot;type&quot;: &quot;package&quot;,
+ /// &quot;compile&quot;: {
+ /// &quot;lib/net45/Newtonsoft.Json.dll&quot;: {}
+ /// },
+ /// &quot;runtime&quot;: {
+ /// &quot;lib/net45/Newtonsoft.Json.dll&quot;: {}
+ /// [rest of string was truncated]&quot;;.
+ /// </summary>
+ internal static string ProjectDependency {
+ get {
+ return ResourceManager.GetString("ProjectDependency", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {
/// &quot;locked&quot;: false,
/// &quot;version&quot;: -9996,
/// &quot;targets&quot;: {
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx
index e2273cf..a59102f 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx
@@ -145,4 +145,7 @@
<data name="MultipleProjectFileDependencyGroups" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>multipleprojectfiledependencygroups.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
+ <data name="ProjectDependency" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>ProjectDependency.assets.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
+ </data>
</root> \ No newline at end of file
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/ProjectDependency.assets.json b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/ProjectDependency.assets.json
new file mode 100644
index 0000000..c718a5a
--- /dev/null
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/ProjectDependency.assets.json
@@ -0,0 +1,213 @@
+{
+ "version": 2,
+ "targets": {
+ ".NETFramework,Version=v4.5.2": {
+ "log4net/2.0.7": {
+ "type": "package",
+ "compile": {
+ "lib/net45-full/log4net.dll": {}
+ },
+ "runtime": {
+ "lib/net45-full/log4net.dll": {}
+ }
+ },
+ "Newtonsoft.Json/9.0.1": {
+ "type": "package",
+ "compile": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ },
+ "runtime": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ }
+ },
+ "ClassLibrary1/1.0.0": {
+ "type": "project"
+ }
+ },
+ ".NETFramework,Version=v4.5.2/win": {
+ "log4net/2.0.7": {
+ "type": "package",
+ "compile": {
+ "lib/net45-full/log4net.dll": {}
+ },
+ "runtime": {
+ "lib/net45-full/log4net.dll": {}
+ }
+ },
+ "Newtonsoft.Json/9.0.1": {
+ "type": "package",
+ "compile": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ },
+ "runtime": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ }
+ },
+ "ClassLibrary1/1.0.0": {
+ "type": "project"
+ }
+ },
+ ".NETFramework,Version=v4.5.2/win-x64": {
+ "log4net/2.0.7": {
+ "type": "package",
+ "compile": {
+ "lib/net45-full/log4net.dll": {}
+ },
+ "runtime": {
+ "lib/net45-full/log4net.dll": {}
+ }
+ },
+ "Newtonsoft.Json/9.0.1": {
+ "type": "package",
+ "compile": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ },
+ "runtime": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ }
+ },
+ "ClassLibrary1/1.0.0": {
+ "type": "project"
+ }
+ },
+ ".NETFramework,Version=v4.5.2/win-x86": {
+ "log4net/2.0.7": {
+ "type": "package",
+ "compile": {
+ "lib/net45-full/log4net.dll": {}
+ },
+ "runtime": {
+ "lib/net45-full/log4net.dll": {}
+ }
+ },
+ "Newtonsoft.Json/9.0.1": {
+ "type": "package",
+ "compile": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ },
+ "runtime": {
+ "lib/net45/Newtonsoft.Json.dll": {}
+ }
+ },
+ "ClassLibrary1/1.0.0": {
+ "type": "project"
+ }
+ }
+ },
+ "libraries": {
+ "log4net/2.0.7": {
+ "sha512": "9zY5lPFy4ppjeaTKwHjXbHe6lhle64Bnwui3YDEnnlo4NzHcUE9/h4BqCn3PCCvYbpwO4+ceWdqk9J/lxrQ9dQ==",
+ "type": "package",
+ "path": "log4net/2.0.7",
+ "files": [
+ "lib/net20-full/log4net.dll",
+ "lib/net20-full/log4net.xml",
+ "lib/net35-client/log4net.dll",
+ "lib/net35-client/log4net.xml",
+ "lib/net35-full/log4net.dll",
+ "lib/net35-full/log4net.xml",
+ "lib/net40-client/log4net.dll",
+ "lib/net40-client/log4net.xml",
+ "lib/net40-full/log4net.dll",
+ "lib/net40-full/log4net.xml",
+ "lib/net45-full/log4net.dll",
+ "lib/net45-full/log4net.xml",
+ "lib/netstandard1.3/log4net.dll",
+ "log4net.2.0.7.nupkg.sha512",
+ "log4net.nuspec"
+ ]
+ },
+ "Newtonsoft.Json/9.0.1": {
+ "sha512": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==",
+ "type": "package",
+ "path": "newtonsoft.json/9.0.1",
+ "files": [
+ "lib/net20/Newtonsoft.Json.dll",
+ "lib/net20/Newtonsoft.Json.xml",
+ "lib/net35/Newtonsoft.Json.dll",
+ "lib/net35/Newtonsoft.Json.xml",
+ "lib/net40/Newtonsoft.Json.dll",
+ "lib/net40/Newtonsoft.Json.xml",
+ "lib/net45/Newtonsoft.Json.dll",
+ "lib/net45/Newtonsoft.Json.xml",
+ "lib/netstandard1.0/Newtonsoft.Json.dll",
+ "lib/netstandard1.0/Newtonsoft.Json.xml",
+ "lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll",
+ "lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.xml",
+ "lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll",
+ "lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.xml",
+ "newtonsoft.json.9.0.1.nupkg.sha512",
+ "newtonsoft.json.nuspec",
+ "tools/install.ps1"
+ ]
+ },
+ "ClassLibrary1/1.0.0": {
+ "type": "project",
+ "path": "../ClassLibrary1/ClassLibrary1.csproj",
+ "msbuildProject": "../ClassLibrary1/ClassLibrary1.csproj"
+ }
+ },
+ "projectFileDependencyGroups": {
+ ".NETFramework,Version=v4.5.2": [
+ "ClassLibrary1 >= 1.0.0",
+ "Newtonsoft.Json >= 9.0.1",
+ "log4net >= 2.0.7"
+ ]
+ },
+ "packageFolders": {
+ "C:\\Users\\tomescht\\.nuget\\packages\\": {}
+ },
+ "project": {
+ "version": "1.0.0",
+ "restore": {
+ "projectUniqueName": "C:\\Users\\tomescht\\Documents\\Visual Studio 2017\\Projects\\WpfApp1\\WpfApp1\\WpfApp1.csproj",
+ "projectName": "WpfApp1",
+ "projectPath": "C:\\Users\\tomescht\\Documents\\Visual Studio 2017\\Projects\\WpfApp1\\WpfApp1\\WpfApp1.csproj",
+ "outputPath": "C:\\Users\\tomescht\\Documents\\Visual Studio 2017\\Projects\\WpfApp1\\WpfApp1\\obj\\",
+ "projectStyle": "PackageReference",
+ "originalTargetFrameworks": [
+ "net452"
+ ],
+ "frameworks": {
+ "net452": {
+ "projectReferences": {
+ "C:\\Users\\tomescht\\Documents\\Visual Studio 2017\\Projects\\WpfApp1\\ClassLibrary1\\ClassLibrary1.csproj": {
+ "projectPath": "C:\\Users\\tomescht\\Documents\\Visual Studio 2017\\Projects\\WpfApp1\\ClassLibrary1\\ClassLibrary1.csproj"
+ }
+ }
+ }
+ }
+ },
+ "dependencies": {
+ "Newtonsoft.Json": {
+ "target": "Package",
+ "version": "9.0.1"
+ },
+ "log4net": {
+ "target": "Package",
+ "version": "[2.0.7, )"
+ }
+ },
+ "frameworks": {
+ "net452": {
+ "dependencies": {
+ "Newtonsoft.Json": {
+ "target": "Package",
+ "version": "9.0.1"
+ }
+ }
+ }
+ },
+ "runtimes": {
+ "win": {
+ "#import": []
+ },
+ "win-x64": {
+ "#import": []
+ },
+ "win-x86": {
+ "#import": []
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj b/src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj
index 2f0c78e..ccf4463 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj
@@ -85,6 +85,7 @@
<None Include="Json\Win10.json" />
<None Include="Json\Win10.xunit.json" />
<None Include="project.json" />
+ <None Include="Json\ProjectDependency.assets.json" />
<None Include="ProjectReferences\LockFileMissingMSBuildProjectThatProvidesAssets.json" />
<None Include="ProjectReferences\LockFileWithCSProjReference.json" />
</ItemGroup>
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/PackageFolderTests.cs b/src/Microsoft.NuGet.Build.Tasks.Tests/PackageFolderTests.cs
index d8ef819..145e469 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/PackageFolderTests.cs
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/PackageFolderTests.cs
@@ -18,7 +18,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
runtimeIdentifier: null,
createTemporaryFolderForPackages: false);
- Assert.Equal(@"C:\PackageFolder\Newtonsoft.Json\8.0.3\lib\net45\Newtonsoft.Json.dll", result.References.Single().ItemSpec);
+ Assert.Equal(@"C:\PackageFolder\newtonsoft.json\8.0.3\lib\net45\Newtonsoft.Json.dll", result.References.Single().ItemSpec);
}
}
}
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs b/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs
index 828a72b..994fdb4 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs
@@ -413,5 +413,16 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
Assert.Contains("FluentAssertions", packageNames);
}
+
+ [Fact]
+ public static void ProjectsNotIncludedInReferences()
+ {
+ var result = NuGetTestHelpers.ResolvePackagesWithJsonFileContents(
+ Json.Json.ProjectDependency,
+ targetMoniker: ".NETFramework,Version=v4.5.2",
+ runtimeIdentifier: "win");
+
+ Assert.DoesNotContain("ClassLibrary1", result.ReferencedPackages.Select(t => t.ItemSpec));
+ }
}
}
diff --git a/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.Build.Tasks.csproj b/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.Build.Tasks.csproj
index 8aba143..3d8611b 100644
--- a/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.Build.Tasks.csproj
+++ b/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.Build.Tasks.csproj
@@ -80,4 +80,4 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets b/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets
index 3dfed11..666a298 100644
--- a/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets
+++ b/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets
@@ -270,6 +270,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup>
<_PackagingOutputsIncludesFramework Condition="'%(PackagingOutputs.FileName)%(PackagingOutputs.Extension)' == 'System.Runtime.dll'">true</_PackagingOutputsIncludesFramework>
<_AppContainsManagedCodeForInjection Condition="'%(PackagingOutputs.Identity)' == '$(_TargetPlatformSdkDir)UnionMetadata\Windows.winmd'">true</_AppContainsManagedCodeForInjection>
+ <_AppContainsManagedCodeForInjection Condition="'%(PackagingOutputs.Identity)' == '$(WindowsSDK_UnionMetadataPath)\Windows.winmd'">true</_AppContainsManagedCodeForInjection>
</PropertyGroup>
<PropertyGroup>
diff --git a/src/Microsoft.NuGet.Build.Tasks/NuGetPackageObject.cs b/src/Microsoft.NuGet.Build.Tasks/NuGetPackageObject.cs
index 696db15..b4add3c 100644
--- a/src/Microsoft.NuGet.Build.Tasks/NuGetPackageObject.cs
+++ b/src/Microsoft.NuGet.Build.Tasks/NuGetPackageObject.cs
@@ -34,6 +34,7 @@ namespace Microsoft.NuGet.Build.Tasks
public string Id { get; }
public string Version { get; }
+ public string RelativePackagePath => (string)LibraryObject["path"];
/// <summary>
/// The JSON object from the "targets" section in the project.lock.json for this package.
diff --git a/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs b/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
index 3e12fb0..f4a7f17 100644
--- a/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
+++ b/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
@@ -369,7 +369,7 @@ namespace Microsoft.NuGet.Build.Tasks
if (Path.GetExtension(file).Equals(".dll", StringComparison.OrdinalIgnoreCase))
{
string path;
- if (TryGetFile(package.Id, package.Version, file, out path))
+ if (TryGetFile(package.Id, package.Version, package.RelativePackagePath, file, out path))
{
var analyzer = new TaskItem(path);
@@ -441,16 +441,16 @@ namespace Microsoft.NuGet.Build.Tasks
}
}
- private bool TryGetFile(string packageName, string packageVersion, string file, out string path)
+ private bool TryGetFile(string packageName, string packageVersion, string packageRelativePath, string file, out string path)
{
if (IsFileValid(file, "C#", "VB"))
{
- path = GetPath(packageName, packageVersion, file);
+ path = GetPath(packageName, packageVersion, packageRelativePath, file);
return true;
}
else if (IsFileValid(file, "VB", "C#"))
{
- path = GetPath(packageName, packageVersion, file);
+ path = GetPath(packageName, packageVersion, packageRelativePath, file);
return true;
}
@@ -469,9 +469,9 @@ namespace Microsoft.NuGet.Build.Tasks
!file.Split('/').Any(x => x.Equals(unExpectedLanguage, StringComparison.OrdinalIgnoreCase)));
}
- private string GetPath(string packageName, string packageVersion, string file)
+ private string GetPath(string packageName, string packageVersion, string packageRelativePath, string file)
{
- return Path.Combine(GetNuGetPackagePath(packageName, packageVersion), file.Replace('/', '\\'));
+ return Path.Combine(GetNuGetPackagePath(packageName, packageVersion, packageRelativePath), file.Replace('/', '\\'));
}
/// <summary>
@@ -854,24 +854,54 @@ namespace Microsoft.NuGet.Build.Tasks
}
var projectFileDependencyGroups = (JObject)lockFile["projectFileDependencyGroups"];
+ var allPackageNames = GetAllPackageNames(lockFile);
if (targetMoniker != null)
{
var targetSpecificDependencies = (JArray)projectFileDependencyGroups[targetMoniker];
if (targetSpecificDependencies != null)
{
- AddReferencedPackages(targetSpecificDependencies);
+ AddReferencedPackages(targetSpecificDependencies, allPackageNames);
}
}
var universalDependencies = (JArray)projectFileDependencyGroups[""];
if (universalDependencies != null)
{
- AddReferencedPackages(universalDependencies);
+ AddReferencedPackages(universalDependencies, allPackageNames);
}
}
- private void AddReferencedPackages(JArray packageDependencies)
+ /// <summary>
+ /// Returns the set of all the package names (not including version numbers)
+ /// in the "libraries" section of the assets/lock file. Note that this includes
+ /// only proper packages; projects are specifically excluded.
+ /// </summary>
+ private static SortedSet<string> GetAllPackageNames(JObject lockFile)
+ {
+ var allPackageNames = new SortedSet<string>();
+ var libraries = (JObject)lockFile["libraries"];
+ foreach (var library in libraries)
+ {
+ var libraryObject = (JObject)library.Value;
+ string type = (string)libraryObject["type"];
+ if (type != null &&
+ type.Equals("project", StringComparison.OrdinalIgnoreCase))
+ {
+ continue;
+ }
+
+ SplitPackageName(library.Key, out string name, out string version);
+ allPackageNames.Add(name);
+ }
+
+ return allPackageNames;
+ }
+
+ /// <summary>
+ /// Given a set of dependencies, identities the packages and adds their names to <see cref="_referencedPackages"/>.
+ /// </summary>
+ private void AddReferencedPackages(JArray packageDependencies, SortedSet<string> allPackageNames)
{
foreach (var packageDependency in packageDependencies.Select(v => (string)v))
{
@@ -881,21 +911,30 @@ namespace Microsoft.NuGet.Build.Tasks
? packageDependency.Substring(0, firstSpace)
: packageDependency;
- _referencedPackages.Add(new TaskItem(packageName));
+ if (allPackageNames.Contains(packageName))
+ {
+ _referencedPackages.Add(new TaskItem(packageName));
+ }
}
}
- private string GetNuGetPackagePath(string packageId, string packageVersion)
+ private string GetNuGetPackagePath(string packageId, string packageVersion, string packageRelativePath)
{
+ string relativePathToUse = String.IsNullOrEmpty(packageRelativePath)
+ ? Path.Combine(packageId, packageVersion)
+ : packageRelativePath.Replace('/', Path.DirectorySeparatorChar);
+
+ string hashFileName = $"{packageId.ToLowerInvariant()}.{packageVersion.ToLowerInvariant()}.nupkg.sha512";
+
foreach (var packagesFolder in _packageFolders)
{
- string packagePath = Path.Combine(packagesFolder, packageId, packageVersion);
+ string packageFullPath = Path.Combine(packagesFolder, relativePathToUse);
// The proper way to check if a package is available is to look for the hash file, since that's the last
// file written as a part of the restore process. If it's not there, it means something failed part way through.
- if (_fileExists(Path.Combine(packagePath, $"{packageId}.{packageVersion}.nupkg.sha512")))
+ if (_fileExists(Path.Combine(packageFullPath, hashFileName)))
{
- return packagePath;
+ return packageFullPath;
}
}
@@ -906,9 +945,7 @@ namespace Microsoft.NuGet.Build.Tasks
{
foreach (var package in target)
{
- var nameParts = package.Key.Split('/');
- var id = nameParts[0];
- var version = nameParts[1];
+ SplitPackageName(package.Key, out string id, out string version);
var libraryObject = (JObject)lockFile["libraries"][package.Key];
@@ -926,13 +963,20 @@ namespace Microsoft.NuGet.Build.Tasks
}
else
{
- fullPackagePathGenerator = () => GetNuGetPackagePath(id, version);
+ fullPackagePathGenerator = () => GetNuGetPackagePath(id, version, (string)libraryObject["path"]);
}
yield return new NuGetPackageObject(id, version, fullPackagePathGenerator, (JObject)package.Value, libraryObject);
}
}
+ private static void SplitPackageName(string key, out string id, out string version)
+ {
+ var nameParts = key.Split('/');
+ id = nameParts[0];
+ version = nameParts[1];
+ }
+
private string GetAbsolutePathFromProjectRelativePath(string path)
{
return Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Path.GetFullPath(ProjectLockFile)), path));