I have a complex software solution that I wanted to separate in several Visual Studio Solutions for greater ease, but it all resulted in a mess, because all the assembly references got broken. I inspected .csproj files and found that the assembly references were right, pointing to the correct file system location, so I didn't understand what was the problem.
So I tried to copy the NuGet "packages" folder to a location nearest to the csproj file, and updated the HintPath to point to the new location and... It magically got fixed!
For example:
This does not work:
<HintPath>..\..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
This works fine:
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
Has anybody else experienced this behavior? Which is the correct way of structuring solutions that share common projects without falling in this annoying problem? Is there any best practice?
Update: I have experienced the same problem again and now the solution has been get back to the original HintPath value and unload and load the project again. I don't know what is the cause, but now the projects compile successfully again. Perhaps Visual Studio has any cache for the paths to the assemblies and gets crazy when the projects are moved to another folder?
