在Web角色部署期间缺少Microsoft.WindowsAzure.Diagnostics

时间:2012-08-10 20:56:32

标签: c# .net azure azure-web-sites

使用Visual Studio 2012 RC,我从该页面开始使用Azure Cloud Service。我选择了MVC 4,包括一个测试项目,并在构建时启用了NuGet包恢复。

当我使用git将其部署到Azure网站时,目标框似乎不包括WindowsAzure.Diagnostics WindowsAzure.ServiceRuntime库。我一般都是.NET新手,但我无法想象我在这里缺少什么。此外,虽然我可以从参考文献中删除诊断(没有诊断,没有问题),但似乎我不能对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.

3 个答案:

答案 0 :(得分:9)

由于程序集引用而导致此错误。

如果安装了Microsoft SDK,引用将存在于引用文件夹中。如果它不在那里,那么我们必须浏览添加到Solution.Even我在运行解决方案时遇到了同样的问题。现在我解决了这个问题,它的工作正常

如果我们安装了windows azure sdk

  

“C:\ Program Files \ Microsoft SDKs \ Windows Azure \ .NET SDK \ 2012-10 \ ref”

所有引用都将在这里。只需将此引用添加到您的解决方案中并构建它,就可以了。

希望这可能有帮助,

谢谢,

答案 1 :(得分:4)

这个问题得到了明确的回答。

但是,最简单的解决方法是将AzureSDK2.2DLLs添加到您的网络角色项目中。

答案 2 :(得分:0)

我相信这是因为您使用的是Visual Studio 2012 Release Candidate,而Visual Studio 2012的Windows Azure工具尚未发布。使用Visual Studio 2010尝试相同的代码,找到所有程序集并解决问题。