gpt4 book ai didi

.net - WAT080 : Failed to locate the Microsoft Azure SDK 有解决方法吗

转载 作者:行者123 更新时间:2023-12-03 05:47:24 27 4
gpt4 key购买 nike

我正在构建一个需要安装 Azure SDK 的项目。不幸的是,我无法安装 SDK,因为 VSTools 安装程序不在 Docker 容器中运行。我正在尝试重新创建安装程序执行的步骤,以便项目认为 SDK 已正确安装。我收到的错误消息是:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\Windows Azure Tools\2.9\Microsoft.WindowsAzure.targets(1093,5): error : WAT080 : Failed to locate the Microsoft Azure SDK. Please make sure t he Microsoft Azure SDK v2.9 is installed. [C:\BuildAgent\work\da35ef67e7dea9a9\EMCloudService\EMCloudService.ccproj]

.targets 文件中的第 1093 行是:

  <Target
Name="VerifySDKInstallation"> // <---- Line 1093

<WATMessage Condition=" !Exists('$(ServiceHostingSDKInstallDir)') or
!Exists('$(ServiceHostingSDKBinDir)') or
!Exists('$(ServiceHostingSDKTaskPath)') "
Type="Error"
Code="WAT080"
Arguments="$(ActiveAzureSdkVersion)" />

<WATMessage Condition=" !Exists('$(AzureClientLibInstallDir)') or
!Exists('$(AzureClientLibToolsRefDir)') or
!Exists('$(StorageClientAssemblyFullPath)') "
Type="Error"
Code="WAT081"
Arguments="$(ActiveAzureClientLibVersion)" />

</Target>

所以,错误似乎是因为这三个路径之一不存在。第一个来自以下行:

<ServiceHostingSDKInstallDir Condition=" '$(ServiceHostingSDKInstallDir)' == '' ">$([MSBuild]::GetRegistryValueFromView('$(ServiceHostingSDKRegistryKey)', 'InstallPath', null, RegistryView.Registry32))</ServiceHostingSDKInstallDir>

所以,基本上它是在注册表中查找。我从工作计算机复制了这个值,它的值是“C:\Program Files\Microsoft SDKs\Azure.NET SDK\”

我复制了该目录。接下来是ServiceHostingSDKBinDir,其定义为:

<ServiceHostingSDKBinDir     Condition=" '$(ServiceHostingSDKBinDir)' == '' ">$(ServiceHostingSDKInstallDir)bin\</ServiceHostingSDKBinDir>

所以这应该没问题,因为 ServiceHostingSDKInstallDir 存在。最后是ServiceHostingSDKTaskPath,它是:

<ServiceHostingSDKTaskPath   Condition=" '$(ServiceHostingSDKTaskPath)' == '' ">$(ServiceHostingSDKBinDir)Microsoft.ServiceHosting.Tools.MSBuildTasks.dll</ServiceHostingSDKTaskPath>

所以,看起来我应该能够复制“C:\Program Files\Microsoft SDKs\Azure.NET SDK\”目录,传入 ActiveAzureSdkVersion 和 ServiceHostingSDKInstallDir 的正确参数,一切都应该正常:

msbuild EM.sln `
/p:ActiveAzureSdkVersion="2.9" `
/p:ServiceHostingSDKInstallDir="C:/Program Files/Microsoft SDKs/Azure/.NET SDK/"

但是,我仍然遇到同样的错误。谁能想到我需要复制或传递的其他内容吗?谢谢!

最佳答案

Is there a workaround for WAT080 : Failed to locate the Microsoft Azure SDK

根据文件Microsoft.WindowsAzure.targets(1093,5) ,我们可以得到以下代码片段:

  <PropertyGroup>
<ActiveAzureSdkVersion Condition=" '$(ActiveAzureSdkVersion)' == '' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure Tools for Microsoft Visual Studio\15.0\v2.9', 'ActiveWindowsAzureVersion', null, RegistryView.Registry32))</ActiveAzureSdkVersion>
<!-- Sdk reversion -->
<ActiveAzureSdkVersion Condition=" '$(ActiveAzureSdkVersion)' == '' ">2.9</ActiveAzureSdkVersion>
<ServiceHostingSDKRegistryKey>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\ServiceHosting\v$(ActiveAzureSdkVersion)</ServiceHostingSDKRegistryKey>
<ServiceHostingSDKInstallDir Condition=" '$(ServiceHostingSDKInstallDir)' == '' ">$([MSBuild]::GetRegistryValueFromView('$(ServiceHostingSDKRegistryKey)', 'InstallPath', null, RegistryView.Registry32))</ServiceHostingSDKInstallDir>

<!-- Ensure ServiceHostingSDKInstallDir has a trailing slash, so it can be concatenated -->
<ServiceHostingSDKInstallDir Condition=" '$(ServiceHostingSDKInstallDir)' != '' and !HasTrailingSlash('$(ServiceHostingSDKInstallDir)')">$(ServiceHostingSDKInstallDir)\</ServiceHostingSDKInstallDir>

...
...
</PropertyGroup>

我们可以知道参数ServiceHostingSDKRegistryKey的值是:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\ServiceHosting\v$(ActiveAzureSdkVersion)

简单知道$(ActiveAzureSdkVersion)的值是2.9,所以ServiceHostingSDKInstallDir的值应该是 InstallPath 的值参数 ServiceHostingSDKRegistryKey

然后,我们打开regedit并将路径切换到上述注册表项:

enter image description here

InstallPath 的值是 C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9\而不是旧值 C:\Program Files\Microsoft SDKs\Azure.NET SDK\ .

此外,您可以发现该Azure SDK的位置也是C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9 ,您在命令行中使用参数 /p:ServiceHostingSDKInstallDir 指定了它.

所以,这个问题的原因是注册表项的值不正确。虽然你用 /p:ServiceHostingSDKInstallDir 重写它,当导入Microsoft.WindowsAzure.targets时到项目文件并执行目标 VerifySDKInstallation ,看来 MSBuild/Visual Studio 将调用 .targets 中的参数 $(ServiceHostingSDKInstallDir)基于就近原则的文件。

此问题的解决方法,您可以尝试将注册表项更改为正确的路径或者如果您不想修改注册表,可以尝试将SDK文件夹复制到旧路径C:\Program Files\Microsoft SDKs\Azure.NET SDK\ .

希望这有帮助。

关于.net - WAT080 : Failed to locate the Microsoft Azure SDK 有解决方法吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52483591/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com