Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Reference Path Manager doesn't see projects in Solution Folders #3

Closed
Imar opened this issue May 21, 2017 · 7 comments
Closed

Reference Path Manager doesn't see projects in Solution Folders #3

Imar opened this issue May 21, 2017 · 7 comments

Comments

@Imar
Copy link

Imar commented May 21, 2017

Only projects directly in the root of the Solution Explorer are seen; projects in Solution Folders are ignored. Steps to reproduce:

  1. Create a new solution in VS 2017
  2. Add two new projects
  3. Choose Tools | Manage solution reference paths
  4. Both projects show up. This is expected
  5. Right-click Solution Explorer and choose Add | New Solution Folder
  6. Drag one of the projects into the new folder.
  7. Choose Tools | Manage solution reference paths

Expected outcome:

  • Both projects are still visible and manageable with the reference path manager

Actual outcome

  • Only the project in the root of the Solution Explorer is visible. The project that was moved to a solution folder has disappeared.

missing project

@Imar
Copy link
Author

Imar commented May 26, 2017

Fixed it with the help of this post: http://www.wwwlicious.com/2011/03/29/envdte-getting-all-projects-html/ and the comments by Johannes

In OnLoad, I changed loading projects as follows:

foreach (Project proj in GetAllProjects(applicationObject.Solution))

and I added the following two methods:

private static IEnumerable<Project> GetAllProjects(Solution sln)
{
  return sln.Projects
    .Cast<Project>()
    .SelectMany(GetProjects);
}

private static IEnumerable<Project> GetProjects(Project project)
{
  if (project.Kind == ProjectKinds.vsProjectKindSolutionFolder)
  {
    return project.ProjectItems
      .Cast<ProjectItem>()
      .Select(x => x.SubProject)
      .Where(x => x != null)
      .SelectMany(GetProjects);
  }
  return new[] { project };
}

I'd create a pull request if I could but for some reason it's not working today.

@rbjorkquist
Copy link

Imar -

I've just attempted to apply the solution you mentioned. I've been able to test it locally by simply replacing the installed 'ReferencePathManager.dll'. I've attempted to push this up and since not working with GitHub before, hope I've done everything correctly.

@Imar
Copy link
Author

Imar commented Nov 2, 2018

Cool thanks. I can see your fork on your user profile in Github. Now fingers crossed that @juanevp will merge this into the main code base and deployed package.

@rbjorkquist
Copy link

Imar -

I've attached the newly built DLL. Simply replace the current one installed on your computer and the functionality is there.

Yesterday:
I used the information in the below Google search and found two locations where it appears the Reference Path Manager was installed.

  1. C:\Users<UserAccount>\AppData\Local\Microsoft\VisualStudio\15.0_4e5a361fExp\Extensions\Juan Vidal Pich\Reference Path Manager\1.0.1
  2. C:\Users<UserAccount>\AppData\Local\Microsoft\VisualStudio\15.0_4e5a361f\Extensions\5kqj2aa4.mli

When I replaced the ReferencePathManager.dll in the first location, I don't remember anything appearing to change; meaning, the sub-projects didn't appear, nor did the changes made using the cursor to indicate something is running. However, I don't remember if I restarted VS2017 or not. But, I know when I replaced the dll in the second location, the extension worked as expected.

As for the second location, I noticed a lot of different folders. I made the assumption there could be another location where it was stored and believe the reason there is, is because of applying Visual Studio updates. So I've left both changes in and am thinking Visual Studio "might" go back to either the original or previous locations to copy over extensions when updates are applied.

Today:
Interesting thing. I've gone back into the initial installation location to help remind me what I did, and I now see a "1.0.2" folder under the initial location. I know I updated my fork to 1.0.2 and didn't realize it would have gotten picked up and deployed.
image

I have a little more investigating on this. I'm not sure if it's because I have the "Automatically update this extension" checked. But I thought my changes had to be merged and/or approved before doing so.
image

Google Search:
image https://docs.microsoft.com/en-us/visualstudio/ide/finding-and-using-visual-studio-extensions?view=vs-2017

Download:
ReferencePathManager.zip

@Imar
Copy link
Author

Imar commented Nov 2, 2018

If you build your (updated) project you get a vsix file. You can run that to install your version into VS,. That works well, but of course you won't be able to update from the online version anymore (but that's not a real issue as there weren't any updates recently anyway ;-) )

@rbjorkquist
Copy link

Oh man ... can't believe I missed that. I knew it didn't feel right to do all I did above and I was looking for the installer too. Sometimes I simply can't see the trees through the forest ... UGH

Regardless, thanks for pointing that out nicely ... have a great day ;-)

@juanevp
Copy link
Owner

juanevp commented Nov 3, 2018

This change was included as version 1.1. Thanks for the enhancement.

@juanevp juanevp closed this as completed Nov 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants