MSBuild找不到引用的DLL [英] MSBuild does not find referenced DLL
问题描述
我看过几篇关于此的帖子,但没有有用的解决方案。
我有两个VS解决方案。解决方案A生成DLL,B引用该DLL。在我的工作站上构建都没有问题。
在我们的构建服务器上,A构建正常,但B的构建失败,因为它找不到A创建的DLL。
这是有道理的,因为构建服务器上的相对路径不一样。
对此有什么解决方法?
Tom
你好tslickers,
欢迎来到MSDN论坛。
根据你的描述,由于相对路径将相对于每个项目文件,我担心没有合适的方法来设置相同的相对路径你建立不同的解决方案。
当B在工作站上引用A时,引用路径是绝对路径,请选择dll以在属性窗口中检查它。
所以如果你想要从A转到B构建路径的dll,你必须指定一个绝对值ute path。
msbuild myproject.proj / p:OutputPath = c:\ mydir
您也可以编辑msbuild项目(.proj文件)将其移动到一个路径。
## 移动任务
<&的ItemGroup GT;
< FilesToMove Include =" .. \..\..\..\..\
(OutServiceDirectory)\%(BuildConfig .AppServer)\ * .DLL" />
< / ItemGroup>
< Target Name =" CombineOutputFile" AfterTargets = QUOT;构建与QUOT;>
< Move SourceFiles =" @(FilesToMove)" DestinationFolder = QUOT;
{DestinationFolder}" />
< / Target>##扩展正常构建的行为以创建正确的输出,请参阅更多
此处。<目标名称= QUOT;构建与QUOT;
DependsOnTargets ="
I've seen a few posts about this but no useful solutions.
I have two VS solutions. Solution A produces a DLL, and B references that DLL. Both build without issue on my workstation.
On our build server, A builds fine, but the build for B fails because it can't find the DLL created by A.
This make some sense because the relative path is not the same on the build server.
What is the fix for this?
Tom
Hi tslickers,
Welcome to MSDN forum.
According to your description, since relative path will go relative to each project file, I'm afraid that there is not an appropriate method to set the same relative path when you build different solutions.
When the B refers A on the workstation, the reference path is absolute path, please select the dll to check it in properties window.
So if you want the dll which is from A to go to B build path, you have to specify an absolute path.
msbuild myproject.proj /p:OutputPath=c:\mydirAlso you could edit msbuild project(.proj file) to move it to one path.
<ItemGroup> <FilesToMove Include="..\..\..\..\..\
(OutServiceDirectory)\%(BuildConfig.AppServer)\*.dll"/> </ItemGroup> <Target Name="CombineOutputFile" AfterTargets="Build"> <Move SourceFiles="@(FilesToMove)" DestinationFolder="
{DestinationFolder}" /> </Target>##Extends the behavior of the normal build to create the proper outputs, please refer to more here.
<Target Name="Build" DependsOnTargets="
这篇关于MSBuild找不到引用的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!