Asp.net-Mvc-3

為什麼 Visual Studio 找不到 System.Web.Mvc.resources.dll?

  • December 19, 2012

我在 Visual Studio 中不斷收到這 11 個錯誤:

Error   456 Could not copy the file "_bin_deployableAssemblies\de\System.Web.Mvc.resources.dll" because it was not found.   ViMuDat
Error   457 Could not copy the file "_bin_deployableAssemblies\de\WebMatrix.WebData.resources.dll" because it was not found.    ViMuDat
Error   458 Could not copy the file "_bin_deployableAssemblies\de\WebMatrix.Data.resources.dll" because it was not found.   ViMuDat
Error   459 Could not copy the file "_bin_deployableAssemblies\de\System.Web.WebPages.resources.dll" because it was not found.  ViMuDat
Error   460 Could not copy the file "_bin_deployableAssemblies\de\System.Web.WebPages.Razor.resources.dll" because it was not found.    ViMuDat
Error   461 Could not copy the file "_bin_deployableAssemblies\de\System.Web.WebPages.Deployment.resources.dll" because it was not found.   ViMuDat
Error   462 Could not copy the file "_bin_deployableAssemblies\de\System.Web.WebPages.Administration.resources.dll" because it was not found.   ViMuDat
Error   463 Could not copy the file "_bin_deployableAssemblies\de\System.Web.Razor.resources.dll" because it was not found. ViMuDat
Error   464 Could not copy the file "_bin_deployableAssemblies\de\System.Web.Helpers.resources.dll" because it was not found.   ViMuDat
Error   465 Could not copy the file "_bin_deployableAssemblies\de\NuGet.Core.resources.dll" because it was not found.   ViMuDat
Error   466 Could not copy the file "_bin_deployableAssemblies\de\Microsoft.Web.Infrastructure.resources.dll" because it was not found. ViMuDat

我嘗試建構一個使用 Visual Studio 2010 開發的項目,但我使用的是 Visual Studio 2012。如果我建構它兩次,它可以正常工作。

我該如何解決?

我發現Bin Deploying ASP.NET MVC 3_bin_deployableAssemblies 和 MSBuild,但我無法修復這些錯誤。有人可以逐步解釋我應該做什麼嗎?我是 C# 和 Visual Studio 的新手。

我認為這個錯誤也是我無法將項目簽入 TFS 的問題。

我的bin文件夾中有這些程序集:

D:\...\bin> ls
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----        18.12.2012     23:53            de
-a---        15.12.2012     21:11     783648 EntityFramework.dll
-a---        15.12.2012     21:11     834489 EntityFramework.xml
-a---        18.12.2012     23:53      42496 LumenWorks.Framework.IO.dll
-a---        18.12.2012     23:53     116224 LumenWorks.Framework.IO.pdb
-a---        18.03.2010     18:31      53640 System.ComponentModel.DataAnnotati
                                            ons.dll
-a---        18.03.2010     18:31    1328984 System.Data.dll
-a---        18.03.2010     18:31     919880 System.dll
-a---        18.03.2010     18:31      24944 System.Web.Abstractions.dll
-a---        18.03.2010     18:31    2824528 System.Web.dll
-a---        05.01.2011     14:45     130408 System.Web.Helpers.dll
-a---        03.05.2012     08:55      37861 System.Web.Helpers.xml
-a---        05.01.2011     16:42     445280 System.Web.Mvc.dll
-a---        03.05.2012     08:51     777665 System.Web.Mvc.xml
-a---        18.03.2010     18:31      24928 System.Web.Routing.dll
-a---        05.01.2011     14:45     136552 System.Web.WebPages.dll
-a---        03.05.2012     08:55      51735 System.Web.WebPages.xml
-a---        18.03.2010     18:31     941904 System.Xml.dll
-a---        18.12.2012     23:53     244736 ViMuDat.dll
-a---        18.12.2012     23:53     321024 ViMuDat.pdb
-a---        18.12.2012     23:53     125308 ViMuDat.XML
D:\...\bin\de> ls
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        12.01.2011     16:04      15720 System.Web.Helpers.resources.dll
-a---        12.01.2011     17:24      32096 System.Web.Mvc.resources.dll
-a---        12.01.2011     16:04      15208 System.Web.WebPages.resources.dll

如果您正在 bin 部署 MVC 3,則必須在部署中打包一些程序集。 Scott Hanselman 也寫了一篇關於什麼和在哪裡的文章。

如果您已復製程序集,請讓使用者將其作為“內容”添加到您的 Visual Studio 項目中。然後在建構時它們將自動複製到 bin 目錄中的正確結構中。

編輯:這是幫助解決問題的文章中的資訊:

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies包含失去的 dll

這些 dll 必須手動複製到_bin_deployableAssemblies我的項目中。

引用自:https://stackoverflow.com/questions/13942703