Reputation: 11722
I'm trying to prevent Visual Studio
from overriding my binary folder of a project which is not supposed to be used during a build. Imaging the following solution structure:
App1 -> LibB -> LibA
Every time I'm trying to build the LibB
project (build/rebuild) it replaces LibA.dll
in my App1
binary folder. The real issue is in different version of LibA.dll
used by App1
and LibB
. Imaging I have another App2
project:
App1 -> LibB (v2) -> LibA (v2)
App2 -> LibB (v2) -> LibA (v2)
LibB (v2) -> LibA (v1)
And now every time I'm building the App1
project it ruins the binary folder of my App2
project because when the LibB
project is build it moves LibA.dll (v1)
to my App2
binary folder which is not expected behavior.
ps#1: I cannot update LibB (v2)
to use LibA (v2)
just because it's a simplified issue description and there are plenty of dependencies like I described above. Let's say it's going to be my long term solution.
ps#2: If you try to build LibB
project it WILL update App1
and App2
binary folders with LibA.dll (v1)
and ruin both app projects.
ps#3: I recreated a test solution with similar dependencies model and it works just fine so it's an issue of the existing solution I'm trying to fix.
How can I prevent Visual Studio
from updating a parent project when a child project is being built?
Upvotes: 4
Views: 309
Reputation: 1924
Don't use project references, instead link to compiled binaries of libraries from some external folder like C:\DeployedBinaries and whenever required copy desired binaries to C:\DeployedBinaries manually.
Upvotes: 0
Reputation: 973
Make sure you have your dependencies across projects sorted and your Configuration Manager settings are proper for a solution-level build
You can always build a specific project individually from within the solution as well
Upvotes: 1
Reputation: 65672
How can I prevent Visual Studio from updating a parent project when a child project is being built?
every time I'm building the App1 project it ruins the binary folder of my App2 project because when the LibB project is build it moves LibA.dll (v1) to my App2 binary folder which is not expected behavior.
I believe it is by-design, never the less one way to stop App1 ruining the Bin Folder of your App2 project is to make copies of the Project Files (.csproj's) and change the Output Bin folder in the Project Properties.
Then have a few different Solution Files (.sln's) to open the different version reference configured projects.
Upvotes: 1
Reputation: 263
When using project references in Visual Studio it is the design of Visual Studio to keep them in sync, this is by design. If you have shared libs across multiple applications you should have them in different solutions and manage the dependencies across solutions with a package management product like nuget.
Upvotes: 1