简体   繁体   English

Visual Studio更新不应构建的项目的二进制文件

[英]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通过使用App1LibB 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)更新App1App2二进制文件夹,并破坏这两个应用程序项目。

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.

相关问题 在Visual Studio 2008中引用dll二进制文件或引用项目时有区别吗? - Is there a difference when referencing dll binaries or referencing a project in Visual Studio 2008? Visual Studio 不会将 Unity 项目的二进制文件放入 output 文件夹 - Visual Studio doesn't put binaries of Unity project to output folder 可以同时使用Visual Studio和Xamarin Studio构建Xamarin项目吗? - Can a Xamarin project be built with both Visual Studio AND Xamarin Studio? 更改Visual Studio 2015社区的内置项目模板 - Change the built-in project templates of Visual Studio 2015 Community 在Visual Studio 2015中创建后,未构建Xamarin UWP项目 - Xamarin UWP project is not being built after creating in Visual Studio 2015 如何在Visual Studio中构建多项目解决方案而不会在二进制文件之间存在依赖关系? - How do I build a multiple project solution in Visual Studio without dependencies between the binaries? Visual Studio项目需要哪些文件? - Which files are required for a Visual Studio project? 有没有办法确保Visual Studio解决方案中的特定Visual Studio项目仅在构建服务器(或特定服务器)上构建 - Is there a way to ensure a specific visual studio project in a visual studio solution is only built on a build server (or a specific server) Visual Studio Publish提供了不同的二进制文件来构建 - Visual Studio Publish gives different binaries to build Visual Studio 项目正在引用已删除的共享项目 - Visual Studio project is referencing a Shared project which has been deleted
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM