Visual Studio 2010 Publish Web feature not including all DLLs

Solution 1:

None of these answers are sufficient in my mind. This does seem to be a genuine bug. I will update this response if I ever find a non-hack solution, or Microsoft fixes the bug.

Update:

Doesn't seem promising. https://connect.microsoft.com/VisualStudio/feedback/details/731303/publish-web-feature-not-including-all-dlls

Solution 2:

I am having this same problem (different assemblies though). If I reference the assemblies in my web project, then they will get included in the publish output, but they should be included anyway because they are indirect dependencies:

Web Project ---> Assembly A ---> Assembly B

On build, assemblies A and B are outputed to the \bin folder. On publish, only assembly A is outputed to the publish folder.

I have tried changing the publish settings to include all files in the web project, but then I have files in my publish output that shouldn't be deployed.

This seems like a bug to me.

Solution 3:

I had the same problem with VS2010 and a WCF Service Application.

It turns out that if your (directly or indirectly) referenced DLL's are deployed to GAC, the VS publishing feature excludes them. Once I removed the assemblies from GAC, publishing feature started working as expected.

I guess VS is assuming that if your assemblies can be located in GAC on the machine you build, they will be located in GAC on the target machine as well. At least in my case this assumption is false.

Solution 4:

My tests show that the external assemblies get published when I have a reference on them in the web project. I do not have to write any dummy code to make it work. This seems acceptable to me.

I agree with Nicholas that this seems to be a bug in visual studio. At least it escapes me what the reason for the behavior could be.

Solution 5:

I have created this issue as a bug on Microsoft Connect. If anyone experiencing it could vote it up https://connect.microsoft.com/VisualStudio/feedback/details/637071/publish-web-feature-not-including-all-dlls then hopefully we'll get something done about it.