Try reading a registry value to get the root path to the installed Wind… #2099
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ows SDK.
Description
When the Windows SDK is installed in a custom location (so not
C:\Program Files (x86)\Windows Kits\...
) the MUXControls.TestApp cannot find the referencedwindows.winmd
file causing build failures when attempting to run interaction tests (via TestExplorer for example).This PR attempts to fix this issue by reading a registry value containing the path to the installed Windows SDK. The value in question is
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots@KitsRoot10
. If this value does not exist we fall back to the currently obtained path usingMSBuildProgramFiles32
.Motivation and Context
Fixes #2088.
How Has This Been Tested?
Tested on my local machine.
Additional info
WIth this fix, the path to the windows.winmd file obtained looks, for example, like this:
Note the double backslashes
...\10\\UnionMetadata\...
. This happens because the registry value is a path containing a trailing backslash and we also manually add a backslash between$(UniversalCRTSdkDir)
andUnionMetadata
.There is no issue on my local machine with the double backslashes. In case this will cause an issue in the Build pipeline though, a possible fix would be to remove the manually added backslash and add a trailing backslash when we define
UniversalCRTSdkDir
in the fallback option usingMSBuildProgramFiles32
, like so:Perhaps we could also remove the trailing backslash from the registry value if that's possible and preferred to above.
Screenshots
Pic showing the registry value: