-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSBuild/CL.exe fails to launch when called from a nodeJS script via Yarn #1566
Conversation
CC @jtpetty who noticed something similar here |
/azp run windows2016, windows2019 |
Azure Pipelines successfully started running 2 pipeline(s). |
@maxim-lobanov how do we get this merged? |
@maxim-lobanov thanks. On a related note I'm seeing something weird I'm hoping you might know the answer to. But the next task, prints out the environment, and that one again has the uppercase version. link |
I think this command doesn't work at all because registry changes are applied only after reboot.
The same about
|
@maxim-lobanov I'm not sure about the reboot requirement, it seems to work ok for me locally if I create a new cmd window (it doesn't work if the cmd process is a child of the original one): Regarding |
@asklar merged. This change should be deployed in 1-2 weeks and should unblock you fully |
Description
New tool, Bug fixing, or Improvement? Bug
Some tools like Yarn will spawn nodeJS via CreateProcess and pass an environment block that contains duplicated environment variables, e.g:
Windows doesn't do any checking of environment variables being duplicated in CreateProcess so the node.exe process gets created with the two names. Then in our case, MSBuild gets launched from within node.exe, which later launches CL.exe and other build tools.
The Azure DevOps CI pipeline sets NPM_CONFIG_CACHE (all caps), while yarn will add the lowercase npm_config_cache to the environment block when a process is launched via child_process.exec()
As a result of this, we are hitting an error in our CI because MultiTaskTool is probably putting variables in a case-insensitive dictionary and doesn't expect to find the same variable twice:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(375,5): error MSB6001: Invalid command line switch for "CL.exe". System.ArgumentException: Item has already been added. Key in dictionary: 'NPM_CONFIG_CACHE' Key being added: 'npm_config_cache' [D:\a\1\s\vnext\Common\Common.vcxproj]
See example run: https://dev.azure.com/ms/react-native-windows/_build/results?buildId=107982&view=logs&j=5435db8c-d05a-5d7b-87ca-9953c4461652&t=397ce80a-0141-5d29-7c56-c592461a0308&l=4585
Related issue:
dotnet/msbuild#5726
Check list