MSBuild: How can I get ProjectReference to search elsewhere in the assembly?

We have a large number of Visual Studio solutions that contain the same common 15 projects, and most of the solutions differ only in the web application.

I try to combine everything into one assembly, which builds common projects only once, and then web application projects reference the output common assemblies.

I find this, since the web project points to common projects through the <ProjectReference> element, I can’t say what it is looking for in another place to build inside my custom assembly project. I would like to use something similar to:

<MSBuild Projects = "@ (Solutions)" Targets = "Rebuild" Properties = "ReferencePath = $ (MyReferencePathFolder)">

but this will only work if the web project references the common assembly DLL through the <Reference> element. It seems that if he cannot find what is specified in the <ProjectReference>, he does not try to look into any ReferencePath folder. He's just giving up.

+3
source share
1 answer

You might consider linking to 15 common assemblies from a well-known location.

You can create a solution containing 15 projects and copy the output to a specific folder. You can then modify your web application projects to reference assemblies, rather than shared projects.

What you lose with this method is the ability to automatically rebuild your collaborative projects from a web application solution. If you want to automatically rebuild 15 assemblies when working on one of the solutions for web applications, you can add a preliminary build step in solutions for web applications to create a new solution for a common project.

+1
source

All Articles