fix dependency version bug
This commit is contained in:
parent
344a730607
commit
ba6b0e5d9b
4 changed files with 18 additions and 6 deletions
|
@ -95,6 +95,7 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
yield return new ProjectContextBuilder()
|
yield return new ProjectContextBuilder()
|
||||||
.WithProject(project)
|
.WithProject(project)
|
||||||
.WithTargetFramework(framework.FrameworkName)
|
.WithTargetFramework(framework.FrameworkName)
|
||||||
|
.WithSettings(settings)
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
|
|
||||||
private Func<string, LockFile> LockFileResolver { get; set; }
|
private Func<string, LockFile> LockFileResolver { get; set; }
|
||||||
|
|
||||||
|
private ProjectReader.Settings Settings { get; set; }
|
||||||
|
|
||||||
public ProjectContextBuilder()
|
public ProjectContextBuilder()
|
||||||
{
|
{
|
||||||
ProjectResolver = ResolveProject;
|
ProjectResolver = ResolveProject;
|
||||||
|
@ -109,6 +111,12 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProjectContextBuilder WithSettings(ProjectReader.Settings settings)
|
||||||
|
{
|
||||||
|
Settings = settings;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<ProjectContext> BuildAllTargets()
|
public IEnumerable<ProjectContext> BuildAllTargets()
|
||||||
{
|
{
|
||||||
ProjectDirectory = Project?.ProjectDirectory ?? ProjectDirectory;
|
ProjectDirectory = Project?.ProjectDirectory ?? ProjectDirectory;
|
||||||
|
@ -165,7 +173,7 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
}
|
}
|
||||||
|
|
||||||
var libraries = new Dictionary<LibraryKey, LibraryDescription>();
|
var libraries = new Dictionary<LibraryKey, LibraryDescription>();
|
||||||
var projectResolver = new ProjectDependencyProvider();
|
var projectResolver = new ProjectDependencyProvider(Settings);
|
||||||
|
|
||||||
var mainProject = projectResolver.GetDescription(TargetFramework, Project);
|
var mainProject = projectResolver.GetDescription(TargetFramework, Project);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
public string VersionSuffix = null;
|
public string VersionSuffix = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool TryGetProject(string path, out Project project, ICollection<DiagnosticMessage> diagnostics = null)
|
public static bool TryGetProject(string path, out Project project, ICollection<DiagnosticMessage> diagnostics = null, Settings settings = null)
|
||||||
{
|
{
|
||||||
project = null;
|
project = null;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
using (var stream = File.OpenRead(projectPath))
|
using (var stream = File.OpenRead(projectPath))
|
||||||
{
|
{
|
||||||
var reader = new ProjectReader();
|
var reader = new ProjectReader();
|
||||||
project = reader.ReadProject(stream, projectName, projectPath, diagnostics);
|
project = reader.ReadProject(stream, projectName, projectPath, diagnostics, settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -15,15 +15,18 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
public class ProjectDependencyProvider
|
public class ProjectDependencyProvider
|
||||||
{
|
{
|
||||||
private Func<string, Project> _resolveProject;
|
private Func<string, Project> _resolveProject;
|
||||||
|
private ProjectReader.Settings _settings;
|
||||||
|
|
||||||
public ProjectDependencyProvider()
|
public ProjectDependencyProvider(ProjectReader.Settings settings = null)
|
||||||
{
|
{
|
||||||
_resolveProject = ResolveProject;
|
_resolveProject = ResolveProject;
|
||||||
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectDependencyProvider(Func<string, Project> projectCacheResolver)
|
public ProjectDependencyProvider(Func<string, Project> projectCacheResolver, ProjectReader.Settings settings = null)
|
||||||
{
|
{
|
||||||
_resolveProject = projectCacheResolver;
|
_resolveProject = projectCacheResolver;
|
||||||
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectDescription GetDescription(string name,
|
public ProjectDescription GetDescription(string name,
|
||||||
|
@ -87,7 +90,7 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
private Project ResolveProject(string path)
|
private Project ResolveProject(string path)
|
||||||
{
|
{
|
||||||
Project project;
|
Project project;
|
||||||
if (ProjectReader.TryGetProject(path, out project))
|
if (ProjectReader.TryGetProject(path, out project, settings: _settings))
|
||||||
{
|
{
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue