错误部署MVC4项目:不能找到文件或程序集错误、文件、程序、项目

2023-09-12 00:06:14 作者:谁先放手谁是猪

在过去我部署我MVC4网站(AWS的弹性魔豆),只需使用Visual Studio 2012发布到AWS菜单项。

In the past I deployed my MVC4 website (to AWS Elastic Beanstalk) simply by using the Visual Studio 2012 "Publish to AWS" menu item.

现在,程序编译和运行在本地,但无法进行部署。从消息,似乎在寻找不在当前项目正在部署,也不是当前项目引用的文件。

Now, the program compiles and runs locally, but fails to deploy. From the messages, it seems to be looking for files that are not in the current project being deployed, nor are they references for the current project.

在一些企图部署,该错误是一个文件,该文件是毫无疑问的文件系统,并在项目中,无法找到。 VS似乎是寻找在错误的地点并没有要求的文件。

On some attempted deploys, the errors are that a file which is unquestionably on the file system and in the project, cannot be found. VS seems to be searching in the wrong locations and for not-required files.

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,但错误仍然存​​在!

I cleaned the project, repaired VS2012, but the errors persist!

推荐答案

由于在评论中建议由吉姆·弗拉纳根,这是A R#(ReSharper的8.2)的集成问题。当R#关闭(工具|选项| ReSharper的|挂起现在)的部署成功。 (请参阅http://youtrack.jetbrains.com/issue/RSRP-411186#tab=Similar%20Issues)

As suggested by Jim Flanagan in the comments this is a R# (Resharper 8.2) integration issue. When R# is turned off (Tools | Options | Resharper | Suspend Now) deployment succeeds. (See http://youtrack.jetbrains.com/issue/RSRP-411186#tab=Similar%20Issues)

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

开启/关闭功能使用的MSBuild获得项目引用。您   可以发现在研发#这样的选项 - >选项 - > VS集成 - >使用的MSBuild到   获得引用

turn on / off ability to use msbuild to obtain project references. You can find such option in R#->Options->VS Integration-> Use msbuild to obtain references

我无法找到我的系统的选项(没有VS集成选项;只是键盘和放大器;菜单),而是完全disabing R·部署的工作就像一个魅力之前

I was unable to find that option on my system (there is no VS Integration option; just "keyboard & Menus"), but completely disabing R# before deployment works like a charm.