microsoft / microsoft/vscode-cpptools

Project path makes compilation tools path not able to be read correctly

Open
#13,049 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted Language Service tasks/build/debug
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

I found out how to reproduce this issue.
(compilation's gonna fail even if the MSVC tools path is correct)

error: 'C:/Program' is not recognized as an internal or external command,
operable program or batch file.

If the path of my project (where ".vscode/tasks.json" is in) has any spaces, the MSVC tools path in tasks.json cannot be read correctly.

e.g.

MSVC tools path: "\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools/VsDevCmd.bat\""
and the project path has no space(C:\Users\Foo\Code\MSVC\C++\learn): cl.exe is launched correctly

MSVC tools path: "\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools/VsDevCmd.bat\""
and the project path has spaces(C:\Users\Foo\Code\MSVC\C++\learn - copy): get error 'C:/Program' is not recognized as an internal or external command

but in this case they'll both work, that's why I'm sure my path is correct:

MSVC tools path: "C:\"/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools/VsDevCmd.bat\""

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with a project path containing spaces and the MSVC tools path shown in the issue, then compare it with the working path without spaces. Start from the .vscode/tasks.json configuration and the VsDevCmd.bat invocation. Done means compilation succeeds when the project path contains spaces without requiring the alternate path syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.