Output Path and MSBuild

爱⌒轻易说出口 提交于 2019-12-12 13:14:48

问题


I have a solution with 9 projects. All references in each project have their CopyLocal property set to False.

When I build it from VS, none of these referenced binaries are copyed to the output build directory. Similarly, when I build using msbuild, I only see the project binaries and no references.

However, when I specify an output path in the msbuild command, some references are copied and I don't know why? Is there some setting I am forgetting to set? Has anyone seen this before?


回答1:


When you build your application without setting the OutDir property, the files are copied to the path specified in project properties (Build\Output path). After this, there is another step that copies the referenced project output (*.dll file) to the OutDir of your application (*.exe). But if you set CopyLocal to false, this last step doesn't happen. Like this:

ProjectEXE\OutDir = c:\a\bin
ProjectDLL\OutDir = c:\b\bin

Pay attention to the fact that the two OutDir are different (and differently specified in your projects properties).

But when you set the OutDir using the command-prompt, you are setting both OutDir parameters to the same path. Still there is no final copy of the DLL to the same directory of your application, except for the fact that it is the same location you built the DLL and EXE first time. Like this:

msbuild yourSolution.sln /p:OutDir="c:\a\bin\"

ProjectEXE\OutDir = c:\a\bin
ProjectDLL\OutDir = c:\a\bin


来源:https://stackoverflow.com/questions/12464350/output-path-and-msbuild

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!