问题
In an ASP.NET MVC3 project I have a structure like this:
Core.csproj
-> 3rdparty1.dll
-> 3rdpartyreference.dll
-> 3rdparty2.dll
Web.csproj
-> core.dll
I'm using the Build Deployment Package feature in VS2010. When I build, there are some references missing in the final bin directory. It only contains the web.dll, core.dll, 3rdparty1.dll and 3rdparty2.dll but is missing the 3rdpartyreference.dll.
How can I force the Deployment functionality to copy all the necessary references? (without manually creating a specific "copy something.dll" instruction in the afterbuild in the csproj)
回答1:
The MSBuild tasks involved in the deployment package and publish features of VS 2010 fail to pickup indirect references by where your app depends on an assembly that depends on another. Either you can copy the files manually (not recommended), or you can add an unused reference variable to your core project that points to some class in the thirdpartyreference.dll. This reference variable, even if unused, will cause VS 2010 to think you have an explicit dependency on that third party dll and copy it to the bin directory as expected.
回答2:
The feature you're looking for is called "Bin deployment". In this article there's a step-by-step solution. Basically, you need to add deployable assemblies to your project - specific folder will show up in your project structure where you can add necessary dll files.
来源:https://stackoverflow.com/questions/9846063/net-mvc-3-deployment-package-missing-references