简体   繁体   English

如何防止引用的程序集的嵌入式依赖项被复制到Visual Studio中的输出文件夹?

[英]How to prevent a referenced assembly's embedded dependency from being copied to output folder in Visual Studio?

I have: 我有:

  1. A.dll - a third-party assembly A.dll-第三方程序集
  2. B.dll - my own class library assembly B.dll-我自己的类库程序集
  3. C.exe - my own executable C.exe-我自己的可执行文件

I am using the Costura.Fody NuGet package to embed A.dll into B.dll , and C.exe has a binary reference to B.dll . 我正在使用Costura.Fody NuGet包A.dll嵌入到B.dll中 ,并且C.exe具有对B.dll的二进制引用。

(A.dll embedded within B.dll) <-- C.exe (嵌入在B.dll中的A.dll)<-C.exe

When I build C.exe, however, A.dll appears in the output folder, despite already being embedded into B.dll (which is also copied to the output folder). 但是,当我构建C.exe时,尽管已将A.dll嵌入到B.dll中(也已复制到输出文件夹中),但它仍显示在输出文件夹中。 I would prefer not to distribute what is essentially two copies of A.dll with my executable, but I would like to distribute A & B as one. 我宁愿不要随我的可执行文件一起分发本质上是A.dll的两个副本,但我想将A和B作为一个副本分发。

In B.dll, the "Copy Local" property of A.dll is set to false, and is instead explicitly included in Costura's FodyWeavers.xml. 在B.dll中,A.dll的“复制本地”属性设置为false,而是明确包含在Costura的FodyWeavers.xml中。

Is there any way I can configure Costura.Fody and/or my reference properties so that A.dll is not copied independently into C.exe's output folder, while B.dll (with the embedded reference to A.dll) is copied? 有什么方法可以配置Costura.Fody和/或我的引用属性,以使A.dll不会独立复制到C.exe的输出文件夹中,而B.dll(带有对A.dll的嵌入式引用)会被复制吗?

据我所知,将需要您要避免的参考程序集。

After referring to msbuild trace log, I found that C.exe was resolving a path to A.dll in Program Files. 引用msbuild跟踪日志后,我发现C.exe正在解析程序文件中A.dll的路径。 Removing A.dll from Program Files solved my issue. 从程序文件中删除A.dll解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 项目引用的依存关系未复制到输出文件夹中 - Dependency of project reference not being copied into output folder 如何防止二进制文件夹也被复制到输出目录? - How to prevent binary file folder also being copied to output dir? 子项目引用的某些DLL未复制到Solution的输出文件夹 - Some DLLs referenced by sub-project not being copied to Solution's output folder 使用Visual Studio 2013将引用项目的依赖项.dll复制到目标输出 - Copy referenced project's dependency .dll's to target output with Visual Studio 2013 防止 Visual Studio 复制引用的 dll - Prevent Visual Studio from duplicating referenced dll 如何防止文件被虚拟化,即从ProgramData文件夹复制到AllUsers文件夹? - How to prevent files from being virtualized, i.e. copied from ProgramData folder into AllUsers folder? 如何防止在辅助类中引用的未使用的 dll 被复制到项目中? - How to prevent unused dll's referenced in helper class to be copied to project? 从属 DLL 未被复制到 Visual Studio 中的构建 output 文件夹 - Dependent DLL is not getting copied to the build output folder in Visual Studio 文件夹未复制到输出目录 - Folder not being copied to Output directory 如何在Visual Studio中单步执行引用的程序集? - How do I step through a referenced assembly in Visual Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM