Greg McPherran

Project A references Project B that is in the same solution. This enables bringing up source code in Project B using "Go To Definition" in C# editor from Project A. However, if one later removes Project B from the solution, then Project A will no longer build and a new reference to B's DLL itself must be added.

If B's DLL itself were referenced even when Project B was in the solution, then Project B could be added/removed from the solution with no effect on Project A's build.

Is there some strategy for referencing Projects so that source code navigation works but the build does not depend on the project being in the solution It seems that ideally one would be able to reference projects for source code navigation without having to re-add the reference as a DLL when the referenced project is removed from the solution.



Re: Visual Studio MSBuild Project References

sluggy

Project B can be in its own solution, just build it within that solution. Then load up Project A, set its reference to the *built* dll produced from Project B (make sure the pdb (debug symbols) are still there). Now when you are debugging Project A, you can just load in the respective cs files from Project B, set breakpoints in them, and trace through them. At no stage does Project B have to be in the same solution as Project A - but do remember to reference a *debug* version if you want to debug through the code.



Re: Visual Studio MSBuild Project References

Greg McPherran

Thanks, but I was referring to code navigation during development, not debug. During development, code navigation only pulls up metadata, not the source code if Project B is in another solution.



Re: Visual Studio MSBuild Project References

sluggy

Then you need to reference the project itself, not just the compiled output.

If that is a problem, then there are a couple of things you could do to mitigate the overhead of referencing Project B:

- create a new solution just containing Project A and Project B. This can be your own custom solution, you don't have to have the solution file under source control or share it with anyone else, just keep it private.

- set Project B to not build (Build -> Configuration Manager), you can save some time that way.





Re: Visual Studio MSBuild Project References

Greg McPherran

It would be efficient if the build is not related to whether Project B, for the purposes of code navigation, is part of the Solution.

However, I accept your answer as confirmation that this is not supported and as an alternative option.

Thank You