2016-03-31 34 views
1

我試圖將GAC部署到SharePoint中。部署失敗,出現此錯誤消息:VS2015構建錯誤:無法將指定的程序集添加到全局程序集緩存

Error occured in deployment step 'Add Solution': Error: Cannot add the specified assembly to the global assembly cache: Microsoft.Practices.Sharepoint.Common.dll

的問題是,所提到的.dll C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Practices.SharePoint.Common\v4.0_2.0.0.0__ef4330804b3c4129\文件夾內由被稱爲Microsoft.Alm.Shared.Remoting.RemoteContainer.dll另一個.dll文件莫名其妙地鎖定。

只有一個工作解決方案是重新啓動Windows服務器,但問題會再次發生,一旦我嘗試部署更新的版本。

是否有任何其他解決方案如何防止阻止此類和其他類似的DLL?

感謝

+0

您是否能夠構建生成解決方案文件的解決方案,然後使用PowerShell命令「Add-SPSolution」或「Update-SPSolution」將解決方案添加到場中?您應該可以使用'-GacDeployment'標誌讓解決方案自動將這些DLL添加到GAC。 – Thriggle

+0

對不起,延遲的答案。不,使用powershell並不能解決問題。 在我看來,VS 2015會阻止自己。因爲重新啓動之後是乾淨的|建立|部署有助於解決問題。 – user2151486

回答

0

命名Microsoft.Alm.Shared.Remoting.RemoteContainer.dll過程在Visual Studio IDE提供的功能 「CodeLens」。這個功能在VS中提供了一些很好的功能,比如在聲明,源代碼控制狀態,測試狀態和其他一些功能上的實時顯示引用。

,如果你在

Visual Studio Options > Text Editor > All Languages > Code Lens

Visual Studio Options > Text Editor > All Languages > Code Lens

禁用在Visual Studio「CodeLens」的問題就會迎刃而解。如果你不想禁用CodeLens所有的時間在該計算機上,你可以在部署之前殺死Microsoft.Alm.Shared.Remoting.RemoteContainer.dll。這將暫時禁用Visual Studio的所有正在運行的實例中的CodeLens,但CodeLens將在重新啓動Visual Studio後再次運行。

要自動查殺試圖註冊的組件安裝到GAC(全局程序集緩存)之前的過程中,您的通話之前,將以下命令添加到同一個地方GACUTIL:

taskkill /f /im Microsoft.Alm.Shared.Remoting.RemoteContainer.dll 

實際觸發問題的原因是解決方案中至少有一個項目從Visual Studio IDE中從GAC加載程序集Microsoft.Practices.Sharepoint.Common.dll。您可以通過將彙編參考點設置爲GAC外部的Microsoft.Practices.Sharepoint.Common.dll版本來阻止此操作。


這個問題也是discussed at Microsoft Connect。微軟並沒有看到這個bug,並表示向GAC註冊程序集,並且不建議在構建期間使用來自GAC的程序集。

+0

明智的答案。像魅力一樣工作 – user2151486

相關問題