WindowsSDK_IncludePath 定义在哪里?

问题描述 投票:0回答:5

宏 $(WindowsSDK_IncludePath) 的值如图所示。

我想知道这些值是在哪里定义的,它们必须在某些文件中定义。

图片取自Visual Studio 2013。

enter image description here

visual-studio visual-studio-2013 visual-studio-2015
5个回答
8
投票

就我而言,

WindowsSDK_IncludePath
变量已正确定义,事实上它在 Visual Studio 2013 中完美运行。所以我什至卸载并重新安装了 VS2015。然后我发现感谢这个链接,预设的宏变量可以通过特定的用户设置进行修改。这些用户设置存储在
C:\Users\<user>\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props
中,在我的例子中,其内容如下:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets">
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup>
    <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\Program Files (x86)\CodeSynthesis XSD 4.0\include;</IncludePath>
    <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);C:\Program Files (x86)\CodeSynthesis XSD 4.0\lib\vc-12.0;</LibraryPath>
    <ExecutablePath>C:\Program Files (x86)\CodeSynthesis XSD 4.0\bin;$(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);</ExecutablePath>
  </PropertyGroup>
  <ItemDefinitionGroup />
  <ItemGroup />
</Project>

不知何故,

<IncludePath>
这句话让VS2015无法找到正确的值。在我的笔记本电脑中,一切正常,文件基本上是空的:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets">
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup>
  </PropertyGroup>
  <ItemDefinitionGroup />
  <ItemGroup />
</Project>

将我的文件设置为与我的笔记本电脑中的文件相同后,一切正常。当然,我失去了 CodeSynthesis XSD 的执行首选项,但现在我没有从事任何使用它的项目。我将继续尝试该文件的不同变体。


6
投票

对我来说,这是文件夹

Microsoft.Cpp.Common.props
中的文件
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
,我必须在其中将硬编码的 Windows 10 SDK 版本从 10.0.10240.0 更改为 10.0.10586.0。

<!-- 10.0.10240.0 is the hardcoded checked-in version of uCRT that we use in case we target 8.1 SDK -->
<TargetUniversalCRTVersion Condition="'$(TargetUniversalCRTVersion)' == ''  and ('$(TargetPlatformVersion)' == '8.1' or '$(DefineWindowsSDK_71A)' == 'true')">10.0.10586.0</TargetUniversalCRTVersion>

我在 Windows 10 上使用 VS2015,但由于缺少包含文件而无法针对 Windows 8.1 SDK 进行编译。安装独立的 Windows 10 SDK 也没有帮助(因为它不包含 10.0.10240 的 ucrt 文件,如 ctype.h a.s.o.)。


5
投票

我在文件夹

sdk.props
中看到文件
C:\Program Files (x86)\Windows Kits\8.0\build\CommonConfiguration\Neutral

中的数据
<PropertyGroup>
     <WindowsSdkDir Condition="'$(WindowsSdkDir)' == ''">$([MSBUILD]::GetDirectoryNameOfFileAbove('$(MSBUILDTHISFILEDIRECTORY)', 'sdkmanifest.xml'))</WindowsSdkDir>
  </PropertyGroup>

  <PropertyGroup>    <WindowsSDK_IncludePath>$(WindowsSdkDir)Include\um;$(WindowsSdkDir)Include\shared;$(WindowsSdkDir)Include\winrt;</WindowsSDK_IncludePath>
  </PropertyGroup>

我使用的是Win8 + VS2012,所以它应该位于VS2013 + 8.1 SDK的文件夹8.1中。


5
投票

我发现原因是:在Windows注册表中是

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots]
"KitsRoot10"="C:\Program Files\Windows Kits\10\"

但正确的路径实际上是:

"KitsRoot10"="C:\Program Files (x86)\Windows Kits\10\"
"AppVerifier64BitAutomationRoot"="C:\Program Files\Application Verifier\"
"KitsRoot81"="C:\Program Files (x86)\Windows Kits\8.1\"

UE论坛推荐相同的解决方案。


1
投票

在 C:\Program Files (x86)\Windows Kits\ 中搜索 *.props

就我而言,导致问题的文件是 UAP.props。编辑文件并将 4.7.1 更改为 4.6.1 解决了该问题。

<PropertyGroup>
    <WindowsSdkDir Condition="'$(WindowsSdkDir)' == ''">$([MSBUILD]::GetDirectoryNameOfFileAbove('$(MSBUILDTHISFILEDIRECTORY)', 'sdkmanifest.xml'))\</WindowsSdkDir>
    <DotNetSdkRoot Condition="'$(DotNetSdkRoot)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.7.1@KitsInstallationFolder)</DotNetSdkRoot>
    <DotNetSdkRoot Condition="'$(DotNetSdkRoot)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.7.1@KitsInstallationFolder)</DotNetSdkRoot>
  </PropertyGroup>
© www.soinside.com 2019 - 2024. All rights reserved.