![]() First, the selection of Windows Platform SDK can be made via the environment variable VC_WIN_SDK_VERSION, giving the developer full control over SDK usage where required (also useful for automated build slaves/nodes). This snippet is designed with two features in mind. $(::ValueOrDefault(`$(WindowsTargetPlatformVersion)`, `9.0`)) $(::ValueOrDefault(`$(WindowsTargetPlatformVersion)`, `$(WinSdkRegistryVersion).0`)) $(::ValueOrDefault(`$(WindowsTargetPlatformVersion)`, `$(VC_WIN_SDK_VERSION)`)) $(::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0', 'ProductVersion', null, RegistryView.Registr圓2)) So here’s what I came up with, which I save to a property sheet called SetWindowsTargetPlatformVersion.props: But since Microsoft has neglected to provide us this information on their own, I’m left with little choice. In general I find the registry to be dangerous and often littered with bogus or out-dated entries (a side effect of it being an entirely separate entity from the programs themselves and also well-hidden from the user). I admit that I was never a fan of querying the registry from an msbuild project. This causes a lot of unnecessary headache among developers since, as far as Windows Native application development is concerned, this very specific SDK version stuff just doesn’t matter. WindowsTargetPlatformVersion and any collaborating developer who attempts to build the project must have precisely that version Windows SDK installed. As a result, every project is forced to define this very specific There’s no built-in logic to fall back on whatever SDK the developer might have installed, and there’s no msbuild property that’s initialized with whatever SDK the developer might have installed. If your project doesn’t request a specific WindowsTargetPlatformVersion then it’s an msbuild error. The odd part is that there’s no default fallback setting. If you’re curious, read later in the entry. ![]() There is a reason for that choice, and it’s both rather lengthy and specifically to do with UWP. An engineering choice made by Microsoft around the time of the release of Visual Studio 2015 was to explicitly require the Windows Platform SDK version to be specified by each and every C project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |