Visual Studio 2010 Publish Web feature not includi

2019-03-08 22:25发布

I have an ASP.NET MVC 2 application.

  • Web project contains a reference to SomeProject
  • SomeProject contains references to ExternalAssembly1 and ExternalAssembly2.
  • SomeProject explicitly calls into ExternalAssembly1, but NOT ExternalAssembly2.
  • ExternalAssembly1 calls into ExternalAssembly2

When I perform a local build everything is cool. All DLLs are included in the bin\debug folder. The problem is that when I use the Publish Web command in Visual Studio 2010, it deploys everything except ExternalAssembly2.

It appears to ignore assemblies that aren't directly used (remember, ExternalAssembly2 is only used by ExternalAssembly1).

Is there any way I can tell Visual Studio 2010 to include ExternalAssembly2?

I can write a dummy method that calls into ExternalAssembly2. This does work, but I really don't want to have dummy code for the sole purpose of causing VS2010 to publish the DLL.

13条回答
相关推荐>>
2楼-- · 2019-03-08 22:32

I don't know if you are watching this still but I found the solution (I had the exact same issue) via this MSDN article. Under "build action" for the file choose "Content" that should include it in the list of files publish brings over.

查看更多
相关推荐>>
3楼-- · 2019-03-08 22:33

If you go into the ExternalAssembly2 reference property list and change the "Copy Local" to "True" i think that might solve your issue.

查看更多
劫难
4楼-- · 2019-03-08 22:40

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.

查看更多
迷人小祖宗
5楼-- · 2019-03-08 22:41

Copy local did the trick. I had an issue that the Newtonsoft.Json assembly get included in the deploymeny package. Copy local was set to false.

查看更多
在下西门庆
6楼-- · 2019-03-08 22:43

I am experiencing the same type of issue with a web project. I have a web project that references assembly A which references assembly B. It worked fine for some time but today it was broken. I did a rebuild of the solution and this time it deployed everything correctly.

查看更多
劫难
7楼-- · 2019-03-08 22:43

I had this same problem today. I published my web project and realized that not all of the reference DLL's were there. In particular, the indirect DLL references.

It turns out that the directory in which I was publishing to was out of disk space (network share). I had just enough space to publish all the files except for few indirect reference DLL's. The sad part is that VS08 didn't throw any errors. It just published the files are usual. I cleared out some HDD space and everything worked fine.

I didn't find the HDD space issue until I tried to manually move the DLL's over.

查看更多
登录 后发表回答