【问题标题】:Why can't Visual Studio find System.Web.Mvc.resources.dll?为什么 Visual Studio 找不到 System.Web.Mvc.resources.dll?
【发布时间】:2012-12-06 05:36:33
【问题描述】:

我在 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 and 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文件夹中真的有这些程序集吗?
  • 没有。我已将文件夹内容列表添加到我的帖子中。

标签: asp.net-mvc-3 visual-studio-2010 razor tfs visual-studio-2012


【解决方案1】:

如果您在 bin 部署 MVC 3,则必须在部署中打包一些程序集。 Scott Hanselman has a good write up 什么和在哪里。

如果您已复制程序集,请让用户将其作为“内容”添加到您的 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

【讨论】:

    【解决方案2】:

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

    NuGet 是一个包管理器,可让您轻松安装和更新项目中的依赖项。它是一个 Visual Studio 扩展,可以从here 安装。

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

    这会将二进制文件添加为正常引用,在构建项目时包含在bin 文件夹中。这将使您不必执行_bin_deployableAssemblies 方法。大多数其他流行的 3rd 方框架(以及许多新的 Microsoft Web 堆栈)也可以在 nuget 上使用。

    【讨论】:

    • 请提供更多信息。我不知道如何使用 C# / ASP.NET 并且简单地提供流行语并不能帮助我(或任何其他搜索此问题答案的初学者)解决问题。哪个核桃?它们如何在 VS2012 中安装?
    • @moose 跟随链接,它将解释什么是 nuget 以及如何安装和管理包。
    猜你喜欢
    • 2023-03-12
    • 2011-07-13
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    • 2011-06-24
    • 2012-11-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多