2013-05-08 71 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.

相關問題