msbuild not copying referenced assembly

拥有回忆 提交于 2019-12-13 06:10:05

问题


I have a solution that contains two projects: - projectA has a nuget reference to ServiceStack ormlite - projectB has a reference to projectA

When I build the solution the outdir for projectA contains all the assembly coming from nuget packages (4 assemblies), whereas the projectB only copies 2 of them. Obviously when I start it I get an FileNotFoundException. I have already tried with no success to add private=true flag

I have seen many references to this problem and it gets very confused now about what is going on here (it seems that msbuild does not handle reference the way I think is the only thing I know:().

Any idea what could be done to have a reliable process to build my solution ?


回答1:


The build will only copy to projectB's output folder the assemblies that are actually used by projectA and result in references in projectA's output assembly, regardless of which assemblies projectA references.

You can open projectA's assembly with Reflector or ildasm and see that of those 4 assemblies only 2 are actually used and referenced.

If the assemblies need to be there at runtime for projectB, add a reference to the NuGet package to projectB as well, or make sure they are copied. This post shows a general-purpose solution, but I haven't tried it.



来源:https://stackoverflow.com/questions/19003244/msbuild-not-copying-referenced-assembly

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