为什么Visual Studio找不到System.Web.Mvc.resources.dll?

Mar*_*oma 8 tfs visual-studio-2010 razor asp.net-mvc-3 visual-studio-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
Run Code Online (Sandbox Code Playgroud)

我尝试构建一个使用Visual Studio 2010开发的项目,但我使用的是Visual Studio 2012.如果我构建它两次,它可以正常工作.

我该如何解决这个问题?

我找到了Bin部署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
Run Code Online (Sandbox Code Playgroud)

Dav*_*yon 9

如果您正在部署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我的项目中.


Tre*_*ley 5

您可能会发现通过nuget安装软件包更容易.

NuGet是一个包管理器,可以轻松地在项目中安装和更新依赖项.它是一个Visual Studio扩展,可以从这里安装.

如果您仍在使用ASP.NET MVC3,则可以使用该命令安装旧版本的软件包Install-Package Microsoft.AspNet.Mvc -Version 3.0.20105.1.

这将添加二进制文件作为正常引用,这些引用在bin构建项目时包含在文件夹中.这将节省您必须采取的_bin_deployableAssemblies方法.大多数其他流行的第三方框架(以及许多新的Microsoft Web堆栈)也可以在nuget上使用.