Invalid command line switch for "cmd.exe" System.argumentException: Item has already been added. (PATH vs Path)
See original GitHub issueHello,
When building my package with Git Bash shell I receive the following error:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(238,5): error MSB6001: Invalid command line switch for "cmd.exe". System.ArgumentException: Item has already been added. Key in dictionary: 'Path' Key being added: 'PATH' [C:\${snip}\build\ZERO_CHECK.vcxproj]
I think this issue is very closely related to this issue: https://github.com/dotnet/msbuild/issues/5726
The problem is not clear how to fix, though MSBUILD suggests that this is a “wontfix” and that I should work around the issue. But it’s not clear what to add to my cmake-js usage to work around this issue. It’s seems the workaround is required in cmake-js?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8 (1 by maintainers)
Top Results From Across the Web
error MSB6001: Invalid command line switch for "CL.exe". Item ...
The error message is complaining that the environment variable PATH is being duplicated. How are you getting to the command line?
Read more >Developers - Invalid command line switch for "cmd.exe" System ...
Invalid command line switch for "cmd.exe" System.argumentException: Item has already been added. (PATH vs Path)
Read more >Migrated the project from VS2003 to VS2019. After that ...
CppCommon.targets(502,5): error MSB6001: Invalid command line switch for "CL.exe". System.ArgumentException: Item has already been added.
Read more >MSB6001: Invalid command line switch for "cmd.exe". | Qt + ...
Hi I've got problem with Visual Studio Express 2013. When I want to compile the code it drive me crazy. Beacause I was...
Read more >NGT - The system cannot find the file specified. cmd.exe /c net ...
If "C:\Windows\System32\WindowsPowerShell\v1.0\" is not present in the PATH variable as shown above or path entry is corrupted the PATH value ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Going through the code it looks like in master this was addressed as a specific workaround:
https://github.com/cmake-js/cmake-js/blob/e311b71564be3925f35f0861f85817a823d4cff0/lib/processHelpers.js#L12
If the sanitize in nodejs could be backported, probably that hardfix could be removed as well.
I tracked the issue down to https://github.com/nodejs/node/pull/35210 so if this could be backported to older versions of nodejs then this issue I think will disappear.