Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1435 - calculation of ResolvedPath for project references #1442

Merged
merged 2 commits into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Microsoft.NET.Build.Tasks.UnitTests
public class GivenAResolvePackageDependenciesTask
{
private static readonly string _packageRoot = "\\root\\packages".Replace('\\', Path.DirectorySeparatorChar);
private static readonly string _projectPath = "\\root\\anypath\\solutiondirectory\\myprojectdir\\myproject.csproj".Replace('\\', Path.DirectorySeparatorChar);

[Theory]
[MemberData(nameof(ItemCounts))]
Expand Down Expand Up @@ -254,8 +255,8 @@ public void ItAssignsPackageDefinitionMetadata()
package.GetMetadata(MetadataKeys.Type).Should().Be("project");
package.GetMetadata(MetadataKeys.Path).Should().Be($"../ClassLibP/project.json");

var resolvedPath = Path.GetDirectoryName(Path.GetFullPath(lockFile.Path));
resolvedPath = Path.GetFullPath(Path.Combine(resolvedPath, "../ClassLibP/ClassLibP.csproj"));
var projectDirectoryPath = Path.GetDirectoryName(Path.GetFullPath(_projectPath));
var resolvedPath = Path.GetFullPath(Path.Combine(projectDirectoryPath, "../ClassLibP/ClassLibP.csproj"));
package.GetMetadata(MetadataKeys.ResolvedPath).Should().Be(resolvedPath);
}
else
Expand Down Expand Up @@ -796,7 +797,7 @@ private ResolvePackageDependencies GetExecutedTask(LockFile lockFile)
var task = new ResolvePackageDependencies(lockFile, resolver)
{
ProjectAssetsFile = lockFile.Path,
ProjectPath = null,
ProjectPath = _projectPath,
ProjectLanguage = null
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ private string ResolveFilePath(string relativePath, string resolvedPackagePath)

private string GetAbsolutePathFromProjectRelativePath(string path)
{
return Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Path.GetFullPath(ProjectAssetsFile)), path));
return Path.GetFullPath(Path.Combine(Path.GetDirectoryName(ProjectPath), path));
}
}
}