部署MVC4项目时出错:无法找到文件或程序集

过去,我只是使用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,但错误仍然存​​在!

[编辑]正如Jim Flanagan在评论中所建议的那样,这是一个R#(Resharper 8.2)集成问题。 当R#关闭时(Tools | Options | Resharper | Suspend Now)部署成功。 (参见http://youtrack.jetbrains.com/issue/RSRP-411186#tab=Similar%20Issues )

R#也( http://youtrack.jetbrains.com/issue/RSRP-411186 )建议

打开/关闭使用msbuild获取项目引用的能力。 您可以在R# – > Options-> VS Integration->使用msbuild中找到此选项以获取参考

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