【问题标题】:Error deploying MVC4 project: Cant find file or assembly部署 MVC4 项目时出错:找不到文件或程序集
【发布时间】:2014-04-11 07:43:25
【问题描述】:

过去,我只需使用 Visual Studio 2012 的“发布到 AWS”菜单项即可部署我的 MVC4 网站(到 AWS Elastic Beanstalk)。

现在,程序在本地编译并运行,但部署失败。从消息来看,它似乎正在寻找不在当前正在部署的项目中的文件,也不是当前项目的引用。

在一些尝试的部署中,错误是无法找到文件系统和项目中毫无疑问的文件。 VS 似乎在错误的位置搜索不需要的文件。

Commencing deployment for project MyWebApp.UI
...building deployment package obj\Debug\Package\Archive...
...package build 'CopyPipelineFiles': error in 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets' at (2567,5): Copying file Content\bootstrap-fam-fam\css\fam-icons.css to obj\Debug\Package\PackageTmp\Content\bootstrap-fam-fam\css\fam-icons.css failed. Could not find a part of the path 'C:\MyWebApp\MyWebApp\MyWebApp.Model.Test\obj\Debug\Package\PackageTmp\Content\bootstrap-fam-fam\css\fam-icons.css'.
...build of project archive failed, abandoning deployment
Commencing deployment for project MyWebApp.UI
...building deployment package obj\Debug\Package\Archive...
...package build 'ResolveAssemblyReference': warning in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets' at (1605,5): Could not resolve this reference. Could not locate the assembly "WebActivator". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
...package build 'ResolveAssemblyReference': warning in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets' at (1605,5): Could not resolve this reference. Could not locate the assembly "WebGrease". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
...package build 'CopyPipelineFiles': error in 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets' at (2185,5): Copying file Web.config to obj\Debug\CSAutoParameterize\original\Web.config failed. Could not find file 'C:\MyWebApp\MyWebApp\Amazon\obj\Debug\CSAutoParameterize\original\Web.config'.
...build of project archive failed, abandoning deployment

我清理了项目,修复了VS2012,但错误仍然存​​在!

【问题讨论】:

  • 我也有同样的问题(虽然我也挂了@组装包)。看起来它正在 c:\WINDOWS\System32 中寻找 web.config... -- ...package build 'ResolveAssemblyReference': error in 'Web.config' at (0,0): Application Configuration file "Web .config”无效。找不到文件“C:\WINDOWS\system32\Web.config”。
  • 请查看更新后的答案

标签: c# visual-studio-2012 amazon-web-services


【解决方案1】:

[编辑] 正如 Jim Flanagan 在 cmets 中所建议的,这是一个 R#(Resharper 8.2)集成问题。当 R# 关闭时(工具 | 选项 | Resharper | 立即暂停)部署成功。 (见http://youtrack.jetbrains.com/issue/RSRP-411186#tab=Similar%20Issues

R# 也 (http://youtrack.jetbrains.com/issue/RSRP-411186) 推荐给

打开/关闭使用 msbuild 获取项目引用的能力。你 可以在 R#->Options->VS Integration-> Use msbuild 中找到这样的选项 获取参考文献

我无法在我的系统上找到该选项(没有 VS 集成选项;只有“键盘和菜单”),但在部署之前完全禁用 R# 就像一个魅力。

【讨论】:

  • 如果您发现问题的不同答案,请告诉我。
  • 这可能是由 AWS Visual Studio Toolkit 运行的 ReSharper 和 msbuild 的问题。一些 AWS 用户在升级到 ReSharper 8.2 后遇到了这种情况。这是 JetBrains 问题:youtrack.jetbrains.com/issue/RSRP-411186。我无法使用 OS/Visual Studio/ReSharper/AWS Toolkit 版本的任何组合重现该问题。
  • Jim 的解决方案是完美的......我更新了答案。谢谢,吉姆!
  • 我遇到了类似的情况 [应用程序配置文件“Web.config”无效。找不到文件“某些项目依赖项的路径,这些依赖项没有或需要 web.config\Web.config”。] 禁用 resharper 解决了这个问题。
  • 我没有 resharper,但我仍然有同样的问题,但我不确定 msbuild
猜你喜欢
  • 2021-02-25
  • 1970-01-01
  • 2011-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-11
  • 2022-01-03
  • 2021-11-29
相关资源
最近更新 更多