[英]Visual Studio updates binaries of project which is not supposed to be built
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. 我试图阻止Visual Studio
覆盖我在构建期间不应该使用的项目的二进制文件夹。 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. 每次我尝试构建LibB
项目(构建/重建)时,它都会替换我的App1
二进制文件夹中的LibA.dll
。 The real issue is in different version of LibA.dll
used by App1
and LibB
. 真正的问题是不同版本的LibA.dll
通过使用App1
和LibB
。 Imaging I have another App2
project: 成像我有另一个App2
项目:
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. 现在,每次我正在构建App1
项目时,它都会破坏我的App2
项目的二进制文件夹,因为当构建LibB
项目时,它会将LibA.dll (v1)
移动到我的App2
二进制文件夹,这不是预期的行为。
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. ps#1:我无法更新LibB (v2)
以使用LibA (v2)
,因为它是一个简化的问题描述,并且有很多依赖,如上所述。 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#2:如果您尝试构建LibB
项目,它将使用LibA.dll (v1)
更新App1
和App2
二进制文件夹,并破坏这两个应用程序项目。
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. ps#3:我重新创建了一个具有类似依赖模型的测试解决方案,它运行得很好,所以这是我正在尝试解决的现有解决方案的问题。
How can I prevent Visual Studio
from updating a parent project when a child project is being built? 如何在构建子项目时阻止Visual Studio
更新父项目?
When using project references in Visual Studio it is the design of Visual Studio to keep them in sync, this is by design. 在Visual Studio中使用项目引用时,Visual Studio的设计是为了使它们保持同步,这是设计使然。 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. 如果您在多个应用程序之间共享库,则应将它们放在不同的解决方案中,并使用像nuget这样的包管理产品来管理解决方案之间的依赖关系。
How can I prevent Visual Studio from updating a parent project when a child project is being built? 如何在构建子项目时阻止Visual Studio更新父项目?
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. 每次我正在构建App1项目时,它都会破坏我的App2项目的二进制文件夹,因为当构建LibB项目时,它会将LibA.dll(v1)移动到我的App2二进制文件夹,这不是预期的行为。
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. 我相信它是按设计的,从来没有一种方法可以阻止App1破坏你的App2项目的Bin文件夹,就是复制Project Files(.csproj)并更改Project Properties中的Output Bin文件夹。
Then have a few different Solution Files (.sln's) to open the different version reference configured projects. 然后有几个不同的解决方案文件(.sln)来打开不同的版本参考配置项目。
Make sure you have your dependencies across projects sorted and your Configuration Manager settings are proper for a solution-level build 确保您对项目的依赖项进行了排序,并且Configuration Manager设置适用于解决方案级别的构建
You can always build a specific project individually from within the solution as well 您始终可以在解决方案中单独构建特定项目
不要使用项目引用 ,而是从某些外部文件夹(如C:\\ DeployedBinaries)链接到库的已编译二进制文件,并在需要时手动将所需二进制文件复制到C:\\ DeployedBinaries 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.