Skip to content

[MSVC]How to set environment variables after opening VSCode #4178

Closed
@swq123459

Description

@swq123459

Type: Debugger

Describe the bug

  • OS and Version:win10 1903 x64
  • VS Code Version:1.37.1
  • C/C++ Extension Version:0.25.0

To Reproduce

Additional context

  • I looked at Developer Command Prompt and found that it was actually setting the environment variables for the current workspace. For example, these variables are set by the vcvarsall.bat batch file.
  • This was not a particularly troublesome issue. But when you have multiple versions of visual studio installed on your computer, things start to get into trouble. Every time you open a project, you need to run the corresponding version of the command line tool, which is very troublesome. If you don't do this, you won't be able to compile, suggesting that you can't find MSBuild (and I don't know if there are any other hidden dangers).
  • Is there any way to import these configurations into the environment variables of VSCode, so that you don't need to start the command line tool and cd workspace run code . with vsCode. Or is there any way to run the load environment variable when vsCode starts?
  • I am using multiple versions of vistual studio now. I hope that VSCode can compile them without having to run the command line tool to load the VC environment beforehand. I feel that this is not elegant enough. If you run vscode directly and then load the VC environment (for example by configuring the .json file), this will be very comfortable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions