MSBuild amd64 fails when linking ucrtd.lib
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
### Steps to reproduce
Attached reproduce project here: [msbuild_amd64_bug.zip](https://github.com/Microsoft/msbuild/files/2958132/msbuild_amd64_bug.zip)
Directory contents:
```
- CompilerIdC.vcxproj
- CMakeCCompilerId.c
```
Command line:
```
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe" CompilerIdC.vcxproj /p:Configuration=Debug /p:Platform=x64
```
### Expected behavior
Build succeeds without warnings or errors.
### Actual behavior
Build fails with 1 error:
```
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.20.27404\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdC.exe" /INCREMENTAL:NO /NO
LOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"leve
l='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdC.lib" /MACHINE:X64 Debug\CMa
keCCompilerId.obj
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\dev\msbuild_amd64_bug\CompilerIdC.vcxproj]
Done Building Project "C:\dev\msbuild_amd64_bug\CompilerIdC.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\dev\msbuild_amd64_bug\CompilerIdC.vcxproj" (default target) (1) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' [C:\dev\msbuild_amd64_bug\CompilerIdC.vcxproj]
0 Warning(s)
1 Error(s)
```
### Environment data
`msbuild /version` output:
```
Microsoft (R) Build Engine version 16.0.443+g5775d0d6bb for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
16.0.443.30039
```
OS info: `Version 1809, OS Build: 17763.316`
### Additional information
When building with the 32-bit version of MSBuild the build succeeds, this is the commandline used:
```
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe" CompilerIdC.vcxproj /p:Configuration=Debug /p:Platform=x64
```
I think this is an issue with the path construction for some of the UniversalCRT properties to the Windows SDK folder:
1. For the issue seen under x64, the following properties are set (presumably) incorrectly as such:
```
UCRTContentRoot = C:\Program Files\Windows Kits\10\
UniversalCRT_IncludePath = C:\Program Files\Windows Kits\10\Include\10.0.17763.0\ucrt;
UniversalCRT_LibraryPath_arm = C:\Program Files\Windows Kits\10\lib\10.0.17763.0\ucrt\arm;
UniversalCRT_LibraryPath_arm64 = C:\Program Files\Windows Kits\10\lib\10.0.17763.0\ucrt\arm64;
UniversalCRT_LibraryPath_x64 = C:\Program Files\Windows Kits\10\lib\10.0.17763.0\ucrt\x64;
UniversalCRT_LibraryPath_x86 = C:\Program Files\Windows Kits\10\lib\10.0.17763.0\ucrt\x86;
```
2. In constrast, the x86 shows the following values for the same properties:
```
UCRTContentRoot = C:\Program Files (x86)\Windows Kits\10\
UniversalCRT_IncludePath = C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;
UniversalCRT_LibraryPath_arm = C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\arm;
UniversalCRT_LibraryPath_arm64 = C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\arm64;
UniversalCRT_LibraryPath_x64 = C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64;
UniversalCRT_LibraryPath_x86 = C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x86;
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.