2012-08-10 109 views
5

使用Visual Studio 2012 RC,從頁面開始,我啓動了Azure Cloud Service。我選擇了MVC 4,包括一個測試項目,並在構建時啓用了NuGet包恢復。Web角色部署期間缺少Microsoft.WindowsAzure.Diagnostics

當我部署這蔚藍的網站,使用Git,似乎目標框不包括任何的WindowsAzure.DiagnosticsWindowsAzure.ServiceRuntime庫。一般來說,我是.NET新手,但我無法想象我在這裏錯過了什麼。此外,雖然我可以輕鬆地從參考中刪除Diagnostics(無診斷,沒有問題),但似乎我無法使用ServiceRuntime做同樣的事情。

我做錯了什麼,或者這是Azure網站中的錯誤?它可以修復嗎?

C:\... [master]> git push azure master 
Counting objects: 17, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (11/11), done. 
Writing objects: 100% (12/12), 216.47 KiB, done. 
Total 12 (delta 5), reused 0 (delta 0) 
remote: New deployment received. 
remote: Updating branch 'master'. 
remote: Preparing deployment for commit id '2cb9c59bd0'. 
remote: Building web project 'MvcWebRole1.csproj'. 
remote: .. 
remote: Successfully installed 'Microsoft.AspNet.WebApi 4.0.20505.0'. 
remote: Successfully installed 'Microsoft.AspNet.Web.Optimization 1.0.0-beta2'. 
remote: Successfully installed 'jQuery.Validation 1.8.1'. 
remote: Successfully installed 'Microsoft.AspNet.Razor 2.0.20505.0'. 
remote: Successfully installed 'Microsoft.AspNet.Providers.Core 1.0'. 
remote: Successfully installed 'Microsoft.AspNet.Providers.LocalDb 1.0'. 
remote: Successfully installed 'jQuery.UI.Combined 1.8.11'. 
remote: Successfully installed 'jQuery 1.6.2'. 
remote: Successfully installed 'Microsoft.AspNet.WebApi.Client 4.0.20505.0'. 
remote: Successfully installed 'Microsoft.AspNet.Mvc 4.0.20505.0'. 
remote: Successfully installed 'Microsoft.AspNet.WebApi.Core 4.0.20505.0'. 
remote: Successfully installed 'Microsoft.AspNet.WebApi.WebHost 4.0.20505.0'. 
remote: Successfully installed 'Microsoft.jQuery.Unobtrusive.Ajax 2.0.20505.0'. 
remote: Successfully installed 'Microsoft.jQuery.Unobtrusive.Validation 2.0.20505.0'. 
remote: Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'. 
remote: Successfully installed 'Microsoft.AspNet.WebPages 2.0.20505.0'. 
remote: Successfully installed 'Modernizr 2.0.6'. 
remote: Successfully installed 'Microsoft.WindowsAzure.ConfigurationManager 1.7.0.0'. 
remote: Successfully installed 'Microsoft.Net.Http 2.0.20505.0'. 
remote: Successfully installed 'WebGrease 1.0.0'. 
remote: Successfully installed 'EntityFramework 5.0.0-rc'. 
remote: Successfully installed 'WindowsAzure.Storage 1.7.0.0'. 
remote: Successfully installed 'knockoutjs 2.0.0'. 
remote: Successfully installed 'Newtonsoft.Json 4.5.1'. 
remote: D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resol 
ve this reference. Could not locate the assembly "Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, 
PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your 
code, you may get compilation errors. [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\MvcWebRole1\MvcWebRole1 
.csproj] 
remote: D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resol 
ve this reference. Could not locate the assembly "Microsoft.WindowsAzure.ServiceRuntime, Version=1.7.0.0, Culture=neutra 
l, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by yo 
ur code, you may get compilation errors. [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\MvcWebRole1\MvcWebRo 
le1.csproj] 
remote: WebRole.cs(5,30): error CS0234: The type or namespace name 'Diagnostics' does not exist in the namespace 'Microsoft.WindowsAzure' (are you missing an assembly reference?) [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\Mv 
cWebRole1\MvcWebRole1.csproj] 
remote: WebRole.cs(6,30): error CS0234: The type or namespace name 'ServiceRuntime' does not exist in the namespace 'Microsoft.WindowsAzure' (are you missing an assembly reference?) [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\MvcWebRole1\MvcWebRole1.csproj] 
remote: WebRole.cs(10,28): error CS0246: The type or namespace name 'RoleEntryPoint' could not be found (are you missing a using directive or an assembly reference?) [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\MvcWebRole1\Mvc 
WebRole1.csproj] 
remote: 
remote: Error - Changes committed to remote repository but your website not updated. 
+0

您是否檢查過服務器上是否存在導致引用錯誤的錯誤文件?按照http://weblogs.asp.net/srkirkland/archive/2012/08/08/git-deployment-to-an-azure-website-keeping-configuration-secrets.aspx,kudu部署引擎爲git提供動力即使從源代碼移除,此處的部署也不會刪除目標上的文件和文件。你可能會ftp進去看看服務器上的bin目錄中是否有一些dll應該不在那裏......或者刪除它們並重新部署新的... – 2012-08-15 05:36:00

+0

我也有同樣的問題,我認爲它的一部分與dll所在的路徑有關。我的項目似乎引用C:\ ProgramFiles這些DLL而不是項目特定的路徑。 – 2012-09-07 01:58:35

回答

9

由於程序集引用而出現此錯誤。

如果安裝了Microsoft SDK,引用將在引用文件夾中。如果它不存在,那麼我們必須瀏覽添加到Solution.Even我運行該解決方案時遇到了同樣的問題。現在我解決了這個問題,它的工作精細。

如果我們安裝的Windows Azure SDK

「C:\ Program Files文件\微軟的SDK \的Windows Azure \ .NET SDK \ 2012-10 \裁判」

所有引用會這裏添加這個參考文件到你的解決方案中並構建它,將會起作用。

但願這很有幫助,

感謝,

+3

http://www.microsoft.com/en-us/download/details.aspx?id=35448 已下載並安裝。現在作品 – 2012-11-07 10:08:11

+0

http://stackoverflow.com/questions/13429867/azure-git-deployment-missing-references-in-2nd-assembly – 2013-05-08 13:20:10

0

我相信這是因爲你使用Visual Studio 2012候選版本和Windows Azure工具爲Visual Studio 2012還沒有公佈。嘗試與Visual Studio 2010相同的代碼,並找到所有程序集並解決問題。

4

這個問題的明確答覆。

但是,最簡單的解決方案是將AzureSDK2.2DLLs添加到您的Web角色項目。