2014-04-01 26 views
3

過去,我只使用Visual Studio 2012「發佈到AWS」菜單項部署了我的MVC4網站(到AWS Elastic Beanstalk)。部署MVC4項目時出錯:無法找到文件或程序集

現在,程序編譯並在本地運行,但未能部署。從消息看來,它似乎在尋找不在正在部署的當前項目中的文件,它們也不是當前項目的參考文件。

對於某些嘗試部署,錯誤是無法找到無疑在文件系統和項目中的文件。 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,但錯誤依然存在!

+0

我有同樣的問題(雖然我也掛@組裝包)。它看起來像它正在尋找c:\ WINDOWS \ System32中的web.config ... - ...包構建'ResolveAssemblyReference':在(0,0)處的'Web.config'中的錯誤:應用程序配置文件「Web .config「無效。找不到文件'C:\ WINDOWS \ system32 \ Web.config'。 – kingdango

+0

請參閱更新的答案 – Jonathan

回答

7

[編輯] 正如Jim Flanagan在評論中所建議的,這是一個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·這樣的選項 - >選項 - > VS集成 - >使用的MSBuild到 獲得引用

我無法找到我的系統上的選項(沒有VS集成選項,只需「鍵盤&菜單「),但在部署之前完全解除R#的工作就像一個魅力。

+0

如果您發現問題的答案不同,請讓我知道。 – Pavel

+2

這可能是由AWS Visual Studio工具包運行的ReSharper和msbuild問題。一些AWS用戶在升級到ReSharper 8.2後遇到了這種情況。以下是JetBrains問題:http://youtrack.jetbrains.com/issue/RSRP-411186。我無法使用OS/Visual Studio/ReSharper/AWS Toolkit版本的任何組合重現此問題。 –

+0

吉姆的解決方案是完美的...我更新了答案。謝謝,吉姆! – Jonathan

相關問題