.net WAT080是否有解决方法:未能找到Microsoft Azure SDK

.net WAT080是否有解决方法:未能找到Microsoft Azure SDK,.net,visual-studio,azure,msbuild,azure-sdk,.net,Visual Studio,Azure,Msbuild,Azure Sdk,我正在构建一个需要安装Azure SDK的项目。不幸的是,我无法安装SDK,因为VSTools安装程序没有在Docker容器中运行。我正在尝试重新创建安装程序执行的步骤,以便项目认为SDK安装正确。我收到的错误消息是: C:\Program Files(x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\Windows Azure工具\2.9\Microsoft.WindowsAzur

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

C:\Program Files(x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\Windows Azure工具\2.9\Microsoft.WindowsAzure.targets(1093,5):错误:WAT080 :未能找到Microsoft Azure SDK。请确认一下,不是吗 已安装Microsoft Azure SDK v2.9。 [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>
然而,我仍然得到同样的错误。有人能想到我还需要复印或传递什么吗?谢谢

WAT080是否有解决方法:未能找到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>
很容易知道
$(ActiveAzureSdkVersion)
的值是2.9,因此
ServiceHostingSDKInstallDir
的值应该是参数
ServiceHostingSDKRegistryKey
InstallPath
的值

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

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

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

因此,出现此问题的原因是注册表项的值不正确。尽管使用
/p:ServiceHostingSDKInstallDir
重新编写,但在将
Microsoft.WindowsAzure.targets
导入项目文件并执行target
VerifySdkinInstallation
时,MSBuild/Visual Studio似乎会调用参数$(ServiceHostingSDKInstallDir)在
.targets
文件中,基于接近原则

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

希望这有帮助

WAT080是否有解决方法:未能找到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>
很容易知道
$(ActiveAzureSdkVersion)
的值是2.9,因此
ServiceHostingSDKInstallDir
的值应该是参数
ServiceHostingSDKRegistryKey
InstallPath
的值

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

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

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

因此,出现此问题的原因是注册表项的值不正确。尽管使用
/p:ServiceHostingSDKInstallDir
重新编写,但在将
Microsoft.WindowsAzure.targets
导入项目文件并执行target
VerifySdkinInstallation
时,MSBuild/Visual Studio似乎会调用参数$(ServiceHostingSDKInstallDir)在
.targets
文件中,基于接近原则

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


希望这有帮助。

找到了这个。真正有帮助的是将以下内容添加到
.targets
文件中,就在第1093行下面:

<Message Text="ServiceHostingSDKInstallDir = $(ServiceHostingSDKInstallDir)" />
<Message Text="ServiceHostingSDKBinDir = $(ServiceHostingSDKBinDir)" />
<Message Text="ServiceHostingSDKTaskPath = $(ServiceHostingSDKTaskPath)" />
因此,路径
C:/Program Files/Microsoft SDK/Azure/.NET SDK/bin\
不存在,因为它缺少版本号。事实证明,
ActiveAzureSdkVersion
参数仅在通过注册表获取路径时使用,因此在我的例子中传递它是没有意义的。相反,我需要传入SDK的完整路径,包括版本:

MSBuild.exe。\EM.sln/p:ServiceHostingSDKInstallDir=“C:/Program 文件/Microsoft SDK/Azure/.NET SDK/v2.9/”


希望这对别人有帮助

找到了这个。真正有帮助的是将以下内容添加到
.targets
文件中,就在第1093行下面:

<Message Text="ServiceHostingSDKInstallDir = $(ServiceHostingSDKInstallDir)" />
<Message Text="ServiceHostingSDKBinDir = $(ServiceHostingSDKBinDir)" />
<Message Text="ServiceHostingSDKTaskPath = $(ServiceHostingSDKTaskPath)" />
因此,路径
C:/Program Files/Microsoft SDK/Azure/.NET SDK/bin\
不存在,因为它缺少版本号。事实证明,
ActiveAzureSdkVersion
参数仅在通过注册表获取路径时使用,因此在我的例子中传递它是没有意义的。相反,我需要传入SDK的完整路径,包括版本:

MSBuild.exe。\EM.sln/p:ServiceHostingSDKInstallDir=“C:/Program 文件/Microsoft SDK/Azure/.NET SDK/v2.9/”


希望这对别人有帮助

我将尝试一下,但我希望找到一种解决方案,它不需要以任何方式修改注册表,只依赖于将文件复制到正确的位置并传递正确的MSB
  <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>
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\ServiceHosting\v$(ActiveAzureSdkVersion)
<Message Text="ServiceHostingSDKInstallDir = $(ServiceHostingSDKInstallDir)" />
<Message Text="ServiceHostingSDKBinDir = $(ServiceHostingSDKBinDir)" />
<Message Text="ServiceHostingSDKTaskPath = $(ServiceHostingSDKTaskPath)" />
ServiceHostingSDKInstallDir = C:/Program Files/Microsoft SDKs/Azure/.NET SDK/
ServiceHostingSDKBinDir = C:/Program Files/Microsoft SDKs/Azure/.NET SDK/bin\
ServiceHostingSDKTaskPath = C:/Program Files/Microsoft SDKs/Azure/.NET SDK/bin\Microsoft.ServiceHosting.Tools.MSBuildTasks.dll