Visual Studio 2010中的吃我的DLL! - 构建之后引用第三方DLL文件丢失 [英] Visual Studio 2010 is Eating My DLLs! - referenced third party dlls missing after build

查看:519
本文介绍了Visual Studio 2010中的吃我的DLL! - 构建之后引用第三方DLL文件丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我拉我的头发了这一点:

Please help I am pulling my hair out over this:

我有一个Visual Studio ASP.NET MVC解决方案,其中一个项目引用第三方DLL, log4net的在这种情况下。我的解决办法的树如下:

I have a Visual Studio ASP.NET MVC solution in which a project references a third party DLL, log4net in this case. My solution tree is as follows:

  • GenericLibrary
  • MyApp.NHibernate
  • MyApp.Library
  • MyApp.WebUI

MyApp.WebUI 的是主开办的MVC Web项目,并引用了的 GenericLibrary MyApp.NHibernate 的MyApp .Library 的。 MyApp.NHibernate 的引用了所有的NHibernate位包​​括log4net的。

MyApp.WebUI is the main start-up MVC web project and has references to GenericLibrary, MyApp.NHibernate and MyApp.Library. MyApp.NHibernate has references to all the NHibernate bits including log4net.

现在的问题是,当我编译我的解决方案log4net的dll文件似乎出现,从MyApp.WebUI项目的/ bin目录中消失,所以NHibernate的抛出错误understandibly。我有我的第二个显示器外观的Web项目的/ bin文件夹在Windows资源管理器窗口,我可以看到log4net的DLL出现然后消失在每次编译,它似乎按顺序发生(出现,消失,再appearm,消失等),而不是随机。

Now the problem is when I compile my solution the log4net dlls seem to appear and disappear from the MyApp.WebUI project's /bin directory, so NHibernate throws errors understandibly. I've had a Windows Explorer window on my second monitor looking at the web project's /bin folder, and I can see the log4net dll appear then disappearing after each compile, it seems to happen in sequence (appear, disappear, re-appearm, disappear etc.) rather than randomly.

MyApp.NHibernate项目是引用log4net的DLL的唯一项目,但GenericLibrary引用了NHibernate的,但不log4net的。 MyApp.NHibernate参考GenericLibrary,MyApp.Library还引用GenericLibrary,但GenericLibrary独树一帜。

MyApp.NHibernate project is the only project which references the log4net dll, but GenericLibrary has a reference to NHibernate but NOT log4net. MyApp.NHibernate references GenericLibrary, MyApp.Library also references GenericLibrary, but GenericLibrary stands alone.

唯一的解决办法我能想到的是将引用添加到主MyApp.WebUI项目的每个外部库/ DLL在我的解决方案中使用(NHibernate的,log4net的,温莎城堡等),来解决这个log4net的问题,以避免这种发生在未来。但是,这并不是一个非常整洁的/分离的解决方案给我。

The only solution I can think of is to add References to the main MyApp.WebUI project for every external library/dll used in my solution (Nhibernate, log4net, Castle Windsor etc.), to fix the log4net issue and avoid this happening in future. But that's not a very neat/decoupled solution to me.

更新::要回答kekekela的问题,我有复制本地设置为true为log4net的参考和MyApp.NHibernate项目引用本身,见下图:

Update: To answer kekekela's question, I have Copy Local set to true for both log4net reference and the MyApp.NHibernate project reference itself, see screenshot below:

更新2: Bizzarely这个问题似乎只影响log4net的DLL。我尝试加入不同的第三方的DLL的MyApp.NHibernate工程,NLOG DLL,这似乎留在原地,而log4net的不断消失,重新出现。

Update 2: Bizzarely this problem only seems to effect log4net dll. I tried adding a different 3rd party dll to the MyApp.NHibernate project, the NLog dll, this seems to stay put whereas the log4net continues to disappear and re-appear.

推荐答案

我有同样的问题。我改变了项目的属性从.NET Framework 4的客户端配置文件到.NET Framework 4的,这似乎解决问题对话框中的目标框架。下面是一个 MSDN 文章描述了目标框架的差异。

I was having this same issue. I changed the target framework in the project's properties dialog from ".NET Framework 4 Client Profile" to ".NET Framework 4" which seems to solve the problem. Here is an msdn article describing the differences in the target frameworks.

这篇关于Visual Studio 2010中的吃我的DLL! - 构建之后引用第三方DLL文件丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆