[英]How to prevent a referenced assembly's embedded dependency from being copied to output folder in Visual Studio?
I have: 我有:
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.