Reference DLL file not copying to bin with deploym

2019-01-12 20:39发布

We have several external DLL files being referenced in our Web Application Project. We have a deployment project for installing on the hosting servers. When we were using .NET 3.5 and Visual Studio 2008 the DLL file were being copied to the bin folder. Since we have upgraded to .NET 4 and Visual Studio 2010 this no longer happens, and we are getting servers errors since the references cannot be found.

CopyLocal is set to true, and I cannot find anything inside the web.config which suggest this is being set elsewhere.

13条回答
我只想做你的唯一
2楼-- · 2019-01-12 21:04

Check the framework of the project in which the DLL file has been referenced. The framework should be .NET 4.0. Please correct it if the framework is Client Profile.

查看更多
ら.Afraid
3楼-- · 2019-01-12 21:11

I am not sure how it was set up in Visual Studio 2008, but I am almost positive that you might have been using the Post-Build event command line. In there you can tell to copy the DLL files you need for deployment. An example is given below:

mkdir $(SolutionDir)\Deployment
copy "$(SolutionDir)Your_Library_Name\Your_Dll_ForDeployement.dll" 
$(SolutionDir)\Deployment\
查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-01-12 21:13

Something weird had happened to my deployment project. When I saw it had no detected dependencies, I removed the primary output and re-added it.

The dependencies are now showing up and being placed in the bin folder when installed.

查看更多
聊天终结者
5楼-- · 2019-01-12 21:15

I was getting exactly the same issue. We have a Visual Studio 2008 project which references the EnterpriseLibrary. When we run our integrated build using TFS and our Web deployment project, all the DLL files are copied over. When we upgraded to Visual Studio 2010, TFS 2010 and WDP 2010, some of the DLL file's were missing. Strangely, this only occurs to some DLL files and not others.

For example, we get the Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll copied in both cases, but not the Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll.

As a workaround I copied the files accross using a "BeforeBuild" step.

It now seems to build OK.

查看更多
再贱就再见
6楼-- · 2019-01-12 21:15

rzen and others, thanks - your comments led to a solution for us.

We have a project that targets version 10 of the Microsoft.ReportViewer.Common.dll and Microsoft.ReportViewer.WebForms.dll assemblies (separate "libs" folder we created at the 'src' level). But when we did a build, the output included version 12, which was recently installed on the build server.

Using comments here, we ensured that 'Copy Local' was set to True and that the flag was set in the project file. However, it was still deploying version 12. So what we found that did the trick was ensuring that the 'Specific Version' property was also set on the two references. Voila, version 10 of each file is now being deployed!

There was much rejoicing.

JH

查看更多
叛逆
7楼-- · 2019-01-12 21:16

There is a bug in Visual Studio 2010. By default the XML in the solution file looks like this:

<Reference Include="DevExpress.SpellChecker.v11.1.Core,
           Version=11.1.5.0,
           Culture=neutral,
           PublicKeyToken=b88d1754d700e49a,
           processorArchitecture=MSIL">
<HintPath>..\References\DevExpress.SpellChecker.v11.1.Core.dll</HintPath>
</Reference>

Whereas MSBuild is expecting this below, so that the DLL file will be included in the deployment:

<Reference Include="DevExpress.SpellChecker.v11.1.Core,
           Version=11.1.5.0,
           Culture=neutral,
           PublicKeyToken=b88d1754d700e49a,
           processorArchitecture=MSIL">
<HintPath>..\References\DevExpress.SpellChecker.v11.1.Core.dll</HintPath>
<Private>True</Private>
</Reference>

The trick is to set Copy Local to False, save the project and then reset it to True - save again. This includes the Private node correctly, which MSBuild respects.

It appears that the default for no included private node (Copy Local) in Visual Studio 2010 is True, while MSBuild reads that missing node as False.

查看更多
登录 后发表回答