Lets say you have a solution with projects A and B. A needs to B be build at least once so in order to be built with MSBuild i need it to be some kind of reference to setup the order of build. But setting up the projects as a reference made it build always together and project B its slow to build while A alone its fast and its the one I need to build multiple times from Visual Studio.
Is there a way to still make MSBuild take the order B -> A on building while beeing capable of build only A from Visual Studio?
I tried to setup a .proj for MSBuild but i kinda dont really understand how it works. I tested putting the reference from .sln with
ProjectSection(ProjectDependencies)
and in .csproj with
<ProjectReference Include="..\B.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
edit: The reason why B needs to be built from time to time its that it can change too and its part of a repository and bin needs to be in .gitignore
edit2: In my case i was modifying some .proj that builds a lot of sln with this exact struct and in the end the "better" aproach was just modifying the sln file to put the project B first and done. 🙃
ProjectReference
is essentially "go to this project, check if the project is up-to-date, build the project if it is not up-to-date, and copy the project's outputs". You can't tell the solution to build A and ignore building B regardless of its state. Is project B always out of date? That could be an issue in the project. Or project B could have its own separate build that produces a NuGet package and project A uses aPackageReference
to the NuGet package.