提交 5f65425c 编写于 作者: K Kevin Pilch-Bisson

Handle relative paths in AnalyzerReference nodes

Also, use PathUtilities consistently.

Fixes internal bug 272652.
上级 296a906b
......@@ -196,7 +196,7 @@ private void OutputToOutputWindow(string message)
}
var commandLineParser = _workspaceServices.GetLanguageServices(languageName).GetService<ICommandLineParserService>();
var projectDirectory = Path.GetDirectoryName(projectFilename);
var projectDirectory = PathUtilities.GetDirectoryName(projectFilename);
var commandLineArguments = commandLineParser.Parse(
projectInfo.CommandLineArguments,
projectDirectory,
......@@ -204,7 +204,7 @@ private void OutputToOutputWindow(string message)
sdkDirectory: RuntimeEnvironment.GetRuntimeDirectory());
// TODO: Should come from sln file?
var projectName = Path.GetFileNameWithoutExtension(projectFilename);
var projectName = PathUtilities.GetFileName(projectFilename, includeExtension: false);
var projectId = GetOrCreateProjectIdForPath(projectFilename, projectName);
// See if we've already created this project and we're now in a recursive call to
......@@ -306,7 +306,15 @@ private void OutputToOutputWindow(string message)
foreach (var reference in commandLineArguments.AnalyzerReferences)
{
projectContext.AddAnalyzerReference(reference.FilePath);
var path = reference.FilePath;
if (!PathUtilities.IsAbsolute(path))
{
path = PathUtilities.CombineAbsoluteAndRelativePaths(
projectDirectory,
path);
}
projectContext.AddAnalyzerReference(path);
}
return (AbstractProject)projectContext;
......@@ -314,7 +322,7 @@ private void OutputToOutputWindow(string message)
private static string GetLanguageOfProject(string projectFilename)
{
switch (Path.GetExtension(projectFilename))
switch (PathUtilities.GetExtension(projectFilename))
{
case ".csproj":
return LanguageNames.CSharp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册