-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Problem
When a project is unloaded in Solution Explorer (either manually or due to a loading error), the extension is unable to find the file path and cannot open it in Notepad++.
This was reported in a Marketplace review:
The extension is really useful, however for some reason if you have a Project file that has something wrong with it, for example it references a .Props file, but that file has moved this results in the VS project system being unable to load the C++ project (vcxproj). That however shouldn't stop Open in Notepad++ from opening the file - especially as you can use NP++ to fix the problem.
However that is exactly what happens. I can find the project from Notepad++ and load it in and fix it there, and then once more this extension will be able to load it.
Cause
When a project is unloaded, the Project.FullName property returns an empty string, causing the extension to fail to resolve the path. Unloaded projects have a specific Kind GUID ({67294A52-A4F0-11D2-AA88-00C04F688DDE}) and require using Project.UniqueName (which contains the relative path from the solution) combined with the solution directory to construct the full path.
Solution
Detect unloaded projects by checking project.Kind against the unloaded project GUID, then fall back to constructing the path from the solution directory and project.UniqueName.