2013-05-08 68 views
1

我试图发布一个解决方案,其中包含几个项目 - 其中之一是MVC- IIS7。 当MVC项目发布和一些看法正在被访问,我得到以下错误:在IIS7上部署多个项目的解决方案 - 缺少DLL

Could not load file or assembly 'NHibernate.Mapping.Attributes, Version=3.2.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The system cannot find the file specified.

这是因为我试图访问的视图调用另一个项目在该解决方案的功能和需要这个图书馆!

但是这个库不包含在MVC项目中!

我能够通过在MVC项目中引用该DLL来解决它!但我需要另一种解决方案,因为在所有其他项目中引用每个DLL都没有意义! 我正在使用MVC项目的“Web Deploy”发布选项,是否有另一种方式可以发布它并使其工作,而无需引用所有其他项目中的所有DLL?

+0

你并不需要参考这些文件在你的MVC项目而只是部署它们。 – 2013-05-08 10:30:23

+0

问题是,所有其他项目都由MVC项目引用并配置为以DLL形式发布! 所以他们没有发布选项! – Ruba 2013-05-09 11:56:40

+1

这并不意味着如果在项目中引用了DLL(即Proj1),而该项目又由另一个项目(即MVC proj)引用,则需要在MVC中引用该DLL。如果您直接在MVC项目中使用DLL中的任何功能(方法),您只需要这样做。现在,即使您没有引用该DLL,也需要将其添加到您的部署中。再次不需要在MVC项目中引用它。 – 2013-05-09 12:03:25

回答

0

有关于如何部署不是由直接的MVC项目引用的程序集的文章: http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx

基本上你需要创建在您的项目称为_bin_deployableAssemblies一个文件夹并添加组件到它。他们将与网站一起部署。

以下是文章报价:

So here’s the kicker. If you’re building a web application, and you need an assembly deployed but don’t want it referenced and don’t want it checked into the bin directory, you can simply add this folder yourself and put your own assemblies in here.

相关问题