提交 889bfaad 编写于 作者: T Tom Meschter

Merge pull request #1792 from tmeschter/Fix1579

Set correct path to linked rule set file.
......@@ -63,6 +63,11 @@ public static bool TryGetItemName(this IVsHierarchy hierarchy, uint itemId, out
return hierarchy.TryGetItemProperty(itemId, __VSHPROPID.VSHPROPID_Name, out name);
}
public static bool TryGetCanonicalName(this IVsHierarchy hierarchy, uint itemId, out string name)
{
return ErrorHandler.Succeeded(hierarchy.GetCanonicalName(itemId, out name));
}
public static bool TryGetParentHierarchy(this IVsHierarchy hierarchy, out IVsHierarchy parentHierarchy)
{
return hierarchy.TryGetProperty(__VSHPROPID.VSHPROPID_ParentHierarchy, out parentHierarchy);
......
......@@ -21,6 +21,7 @@
using Microsoft.VisualStudio.LanguageServices.SolutionExplorer;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Roslyn.Utilities;
using VSLangProj140;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer
......@@ -485,11 +486,14 @@ private void OpenDiagnosticHelpLinkHandler(object sender, EventArgs e)
private void SetActiveRuleSetHandler(object sender, EventArgs e)
{
EnvDTE.Project project;
string fileName;
string ruleSetFileFullPath;
if (_tracker.SelectedHierarchy.TryGetProject(out project) &&
_tracker.SelectedHierarchy.TryGetItemName(_tracker.SelectedItemId, out fileName))
_tracker.SelectedHierarchy.TryGetCanonicalName(_tracker.SelectedItemId, out ruleSetFileFullPath))
{
UpdateProjectConfigurationsToUseRuleSetFile(project, fileName);
string projectDirectoryFullPath = Path.GetDirectoryName(project.FullName);
string ruleSetFileRelativePath = FilePathUtilities.GetRelativePath(projectDirectoryFullPath, ruleSetFileFullPath);
UpdateProjectConfigurationsToUseRuleSetFile(project, ruleSetFileRelativePath);
}
}
......
......@@ -34,6 +34,10 @@
<Project>{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}</Project>
<Name>CodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Desktop\Workspaces.Desktop.csproj">
<Project>{2e87fa96-50bb-4607-8676-46521599f998}</Project>
<Name>Workspaces.Desktop</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
......
......@@ -136,6 +136,7 @@
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.CSharp" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Implementation" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.SolutionExplorer" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.Telemetry" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.VisualBasic" />
<InternalsVisibleTo Include="Roslyn.InteractiveFeatures" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册