Distinguish between the msbuild project path and csproj file path
This commit is contained in:
parent
fd3a7a0a5f
commit
b7ca1d14bd
2 changed files with 15 additions and 6 deletions
|
@ -10,11 +10,15 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
/// <summary>
|
||||
/// Represents an MSBuild project.
|
||||
/// It has been invisibly built by MSBuild, so it behaves like a package: can provide all assets up front
|
||||
///
|
||||
/// Path points to the project's directory
|
||||
/// MSBuildPRojectPath points to the csproj file
|
||||
/// </summary>
|
||||
public class MSBuildProjectDescription : TargetLibraryWithAssets
|
||||
{
|
||||
public MSBuildProjectDescription(
|
||||
string path,
|
||||
string msbuildProjectPath,
|
||||
LockFileProjectLibrary projectLibrary,
|
||||
LockFileTargetLibrary lockFileLibrary,
|
||||
Project projectFile,
|
||||
|
@ -31,12 +35,15 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
compatible: compatible,
|
||||
framework: null)
|
||||
{
|
||||
MSBuildProjectPath = msbuildProjectPath;
|
||||
ProjectFile = projectFile;
|
||||
ProjectLibrary = projectLibrary;
|
||||
}
|
||||
|
||||
public LockFileProjectLibrary ProjectLibrary { get; }
|
||||
|
||||
public string MSBuildProjectPath { get; set; }
|
||||
|
||||
public Project ProjectFile { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,13 +30,16 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
|||
var dependencies = new List<LibraryRange>(targetLibrary.Dependencies.Count + targetLibrary.FrameworkAssemblies.Count);
|
||||
PopulateDependencies(dependencies, targetLibrary, targetFramework);
|
||||
|
||||
var msbuildProjectPath = GetMSbuildProjectPath(projectLibrary);
|
||||
var exists = Directory.Exists(msbuildProjectPath);
|
||||
var msbuildProjectFilePath = GetMSBuildProjectFilePath(projectLibrary);
|
||||
var msbuildProjectDirectoryPath = Path.GetDirectoryName(msbuildProjectFilePath);
|
||||
|
||||
var exists = Directory.Exists(msbuildProjectDirectoryPath);
|
||||
|
||||
var projectFile = projectLibrary.Path == null ? null : _projectResolver(projectLibrary.Path);
|
||||
|
||||
var msbuildPackageDescription = new MSBuildProjectDescription(
|
||||
msbuildProjectPath,
|
||||
msbuildProjectDirectoryPath,
|
||||
msbuildProjectFilePath,
|
||||
projectLibrary,
|
||||
targetLibrary,
|
||||
projectFile,
|
||||
|
@ -47,7 +50,7 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
|||
return msbuildPackageDescription;
|
||||
}
|
||||
|
||||
private string GetMSbuildProjectPath(LockFileProjectLibrary projectLibrary)
|
||||
private string GetMSBuildProjectFilePath(LockFileProjectLibrary projectLibrary)
|
||||
{
|
||||
if (_rootProject == null)
|
||||
{
|
||||
|
@ -56,9 +59,8 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
|||
|
||||
var rootProjectPath = Path.GetDirectoryName(_rootProject.ProjectFilePath);
|
||||
var msbuildProjectFilePath = Path.Combine(rootProjectPath, projectLibrary.MSBuildProject);
|
||||
var msbuildProjectPath = Path.GetDirectoryName(Path.GetFullPath(msbuildProjectFilePath));
|
||||
|
||||
return msbuildProjectPath;
|
||||
return Path.GetFullPath(msbuildProjectFilePath);
|
||||
}
|
||||
|
||||
private void PopulateDependencies(
|
||||
|
|
Loading…
Reference in a new issue