VS2019:资源编译器的 WINVER 宏错误

VS2019: WINVER macro is wrong for resources compiler

我有 2 个相同的 VS2010 和 VS2019 项目。他们继承了“.props”文件,其中定义了 WIN32;_WINDOWS;_WIN32_IE=0x0600;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_WINDOWS=0x0601;
CPP 文件运行良好并且这些定义是正确的。 RC编译器在VS2010也能正常运行,但是在VS2019就报错 Error RC2104 undefined keyword or key name: IDTRYAGAIN
出现这个错误的原因是IDTRYAGAIN被隐藏了:

//WinUser.h
#if(WINVER >= 0x0500)
#define IDTRYAGAIN      10
#define IDCONTINUE      11
#endif /* WINVER >= 0x0500 */ 

因为 WINVER 突然等于 0x0400 看来我的项目中的 RC 设置相同,命令行如下所示:
/l 0x0409 /nologo /fo"my_path\%(Filename).res"

我发现的所有不同之处在于,在 VS2019 中,"Inherit from parent of project defaults" 上的 "Undefine Preprocessor Definitions" 点导致评估值: %(UndefinePreprocessorDefinitions) 但正如我们所见,它不会影响命令行...
如果我在 RC 设置中隐式定义所需的 WINVER,则 VS2019 开始正常工作。
这里有什么问题? VS2010 和 VS2019 的 RC 相关行为是否存在差异?

UPD.
来自 VS2010 的日志:

> Task "RC"
1>  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /l"0x0409" /nologo /fo" my_path\my_res_out.res" my_path\my_res.rc   
1>  Tracking command:  
1>  C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\Tracker.exe /d C:\Windows\Microsoft.NET\Framework\v4.0.30319\FileTracker.dll /i my_path /r my_path\my_res.RC /b MSBuildConsole_CancelEvent31c756f06d7d4121bb209443c669a690  /c "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe"  /l"0x0409" /nologo /fo"my_path\my_res_out.res" my_path\my_res.rc 
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winuser.h(9835): warning RC4005: 'LB_ADDSTRING' : redefinition
1>  
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winuser.h(9983): warning RC4005: 'CB_ADDSTRING' : redefinition
1>  
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(54): warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_STANDA'
1>  
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(76): warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_SECURE' 

来自 VS2019 的日志:

> Task "RC"
1>    Task Parameter:Source=my_path\my_res.rc
1>    Task Parameter:Culture=0x0409
1>    Task Parameter:ResourceOutputFileName=my_path\my_res_out.res
1>    Task Parameter:SuppressStartupBanner=True
1>    Task Parameter:UseResponseFile=False
1>    Task Parameter:TrackerLogDirectory=my_path\.tlog\
1>    Task Parameter:MinimalRebuildFromTracking=True
1>    Task Parameter:ToolArchitecture=Native32Bit
1>    Task Parameter:
1>        ExcludedInputPaths=
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\include
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\atlmfc\include
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Auxiliary\VS\include
1>            C:\Program Files (x86)\Windows Kits\Include.0.18362.0\ucrt
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Auxiliary\VS\UnitTest\include
1>            C:\Program Files (x86)\Windows Kits\Include.0.18362.0\um
1>            C:\Program Files (x86)\Windows Kits\Include.0.18362.0\shared
1>            C:\Program Files (x86)\Windows Kits\Include.0.18362.0\winrt
1>            C:\Program Files (x86)\Windows Kits\Include.0.18362.0\cppwinrt
1>            C:\Program Files (x86)\Windows Kits\NETFXSDK.7.2\Include\um
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\bin\HostX86\arm6433
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\bin\HostX86\x6433
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\bin\HostX86\x8633
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\bin\HostX64\arm6433
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\bin\HostX64\arm33
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\bin\HostX64\x6433
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\bin\HostX64\x8633
1>            C:\Program Files (x86)\Windows Kits\bin.0.18362.0\x86
1>            C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\Common7\tools
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\Common7\ide
1>            C:\Program Files (x86)\HTML Help Workshop
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Current\Bin
1>            C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Current\Bin
1>            C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\
1>            C:\WINDOWS
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\bin\HostX86\x64
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\bin\HostX86\x86
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\lib\x64
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Tools\MSVC.25.28610\atlmfc\lib\x64
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Auxiliary\VS\lib\x64
1>            C:\Program Files (x86)\Windows Kits\lib.0.18362.0\ucrt\x64
1>            C:\Program Files (x86)\Microsoft Visual Studio19\Professional\VC\Auxiliary\VS\UnitTest\lib
1>    Task Parameter:TrackFileAccess=True
1>    Write Tracking Logs: my_path\rc.write.1.tlog
1>    Read Tracking Logs:
1>    my_path\rc.read.1.tlog
1>    C:\Program Files (x86)\Windows Kits\bin.0.18362.0\x86\rc.exe /l"0x0409" /nologo /fo"my_path\my_res_out.res" my_path\my_res.rc
1>    Tracking command:
1>    C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Current\Bin\Tracker.exe /d "C:\Program Files (x86)\MSBuild.0\FileTracker\FileTracker32.dll" /i my_path.tlog /r my_path\my_res.RC /b MSBuildConsole_CancelEventb9a11d84798d4cc392e905b288f0a5ec  /c "C:\Program Files (x86)\Windows Kits\bin.0.18362.0\x86\rc.exe"  /l"0x0409" /nologo /fo"my_path\my_res_out.res" my_path\my_res.rc
1>    C:\Program Files (x86)\Windows Kits\Include.0.18362.0\um\winuser.h(11682): warning RC4005: 'LB_ADDSTRING' : redefinition
1>
1>    C:\Program Files (x86)\Windows Kits\Include.0.18362.0\um\winuser.h(11830): warning RC4005: 'CB_ADDSTRING' : redefinition
1>
1>    my_path\my_res.rc(90): error RC2104: undefined keyword or key name: IDTRYAGAIN
1>
1>    The command exited with code 1.

(为简化阅读省略了路径和名称)

资源编译器不从编译器继承宏定义:它使用自己的集合。 我想在 VS2010 中它运行良好只是运气好:在 WinAPI 中包含 header 的顺序导致定义默认 WINVER 以适合我的项目价值。现在顺序改变了,默认值不同了[=​​13=] 为了解决我的问题,我在道具文件中使用了明确的定义,如:

<ResourceCompile>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">WIN32;_WINDOWS;_WIN32_IE=0x0600;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_WINDOWS=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>