Replies: 1 comment 1 reply
-
I haven't been able to find anywhere that the solution filter's file name is publicly accessible, but there is a property on the internal private async Task<string?> GetSolutionFilterFilePath() {
Solution? solution;
solution = await VS.Solutions.GetCurrentSolutionAsync();
if (solution is not null) {
PropertyInfo? solutionFilterFilePathProperty;
solution.GetItemInfo(out IVsHierarchy hierarchy, out _, out _);
solutionFilterFilePathProperty = hierarchy.GetType().GetProperty("SolutionFilterFilePath");
if (solutionFilterFilePathProperty is not null) {
return solutionFilterFilePathProperty.GetValue(hierarchy) as string;
}
}
return null;
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, in my VSIX I'm trying to determine what solution filter is opened now in VS. Looks like there is no correct way to do this.
I'd found 2 ugly workarounds:
1 (take the name)
where
c
may contains aslnf
file name in. But it's only a name, not the path. I need it so badly, so I found a second way:2 (take the path)
this workaround provides a full path to
snlf
file, but looks horrible, and does not work fine in scenarios where the current sln/slnf is changing.So, any ideas? I'd posted a ticket, but get no response at all...
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions