【问题标题】:How to I configure Visual Studio 2013 to Link to Windows Kit 10 and not 8.1如何将 Visual Studio 2013 配置为链接到 Windows Kit 10 而不是 8.1
【发布时间】:2016-06-26 16:13:02
【问题描述】:

我在过去 2 个小时里在 Google 上搜索了这个主题,但无法让它工作,所以希望一些 Visual Studio Guru 能够帮助我。

首先是一些基础知识。 我正在使用 Visual Studio 2013 Professional(32 位)在 Windows 10 上开发,我的 VS 与C:\Program Files (x86)\Windows Kits\8.1 的链接非常好

我还安装了 8.0 版本的 Windows Kit,但据我所知,VS2013 并没有使用它。同样,我安装了 Visual Studio 2010,但未用于此项目。

我的代码需要使用 VersionHelpers.h 中的 IsWindows10OrGreater() 函数,该函数仅在 Windows kit 10 中可用。

我已经安装了 Windows Kit 10,它已安装到 C:\Program Files (x86)\Windows Kits\10

到目前为止一切顺利。 Windows Kit 10 的安装创建了一个环境变量。它没有删除旧的 Windows Kit 8.1 环境变量,但我已经尝试过解决问题,但没有成功。

问题是 Visual Studio 2013 正在链接到 8.1 sdk。

我尝试将 10 条路径添加到 INCLUDE、LIB 和 LIBPATH(它已经在 PATH 中),因为我看到这些在 vcvars32.bat 中设置。这不起作用。

经过大量挖掘后,我设法在project>properties>C/C++/Preprocessor>Preprocessor 定义下找到,在宏中我注意到有一些 Marcos 定义了指向C:\Program Files (x86)\Windows Kits\8.1,但我找不到更改这些宏的方法。

谁能告诉我如何配置 Visual Studio 以指向正确的 SDK。

提前致谢

托马斯

【问题讨论】:

  • 您是否遇到包括 VersionHelpers.h 在内的问题,或者在链接到 kernel32.dll 时是否会失败?
  • 它包含很好的使用 不是绝对路径,但如果我打开包含的文件,它是 Windows Kits/8.1/ 中的一个,我可以使用该文件中的函数查找例如 iswindows8orgreater()跨度>
  • 所以它包含正确的文件。
  • 没有不是正确的版本

标签: windows visual-studio winapi visual-studio-2013 environment-variables


【解决方案1】:

基于我用于 VS2010 的旧 SDK 8,我编写了这个似乎可以工作的属性表。 您需要验证文件夹对于您的 WDK 10 安装是否正确,并注意这仅适用于 x64。

创建文件Windows10SDK_X64.props

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup>
    <ExecutablePath>$(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(ProgramFiles)\Windows Kits\10\bin\x86;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)\bin;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)</ExecutablePath>
    <IncludePath>$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\shared;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(FrameworkSDKDir)\include;</IncludePath>
    <LibraryPath>$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(ProgramFiles)\Windows Kits\10\lib\10.0.10240.0\um\x64;$(FrameworkSDKDir)\lib\x64</LibraryPath>
    <ExcludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\um;$(ProgramFiles)\Windows Kits\10\Include\10.0.10240.0\shared;$(FrameworkSDKDir)\include;$(MSBuildToolsPath32);$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib;</ExcludePath>
    </PropertyGroup>
<ItemDefinitionGroup />
</Project>

确保清理并重建。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-01
    • 2015-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多