- How Do I Compile A Visual Studio Project From The Command-line?
- Visual Studio Command Line Git
- Visual Studio Command Line 2019
- C# - Build Visual Studio Project Through The Command Line ..
- Developer Command Files And LocationsIf You Prefer To Set The Build Architecture Environment In An Existing Command Prompt Window, You Can Use One Of The Command Files (batch Files) Cr..
Visual Studio 2019 includes two command-line shells for developers:
- Visual Studio Code has many command line options, including code. That opens Visual Studio Code with the current folder. When you do this with a folder containing a dev container, Visual Studio Code will prompt you to reopen the folder within a dev container.
- Visual Studio Code has many command line options, including code. That opens Visual Studio Code with the current folder. When you do this with a folder containing a dev container, Visual Studio Code will prompt you to reopen the folder within a dev container.
Visual Studio Developer Command Prompt - A standard command prompt with certain environment variables set to make using command-line developer tools easier. Available since Visual Studio 2015.
Visual Studio Developer PowerShell - More powerful than a command prompt. For example, you can pass the output of one command (known as a cmdlet) to another cmdlet. This shell has the same environment variables set as Developer Command Prompt. Available since Visual Studio 2019.
Starting in Visual Studio 2019 version 16.5, Visual Studio includes an integrated terminal that can host either of these shells (Developer Command Prompt and Developer PowerShell). You can also open multiple tabs of each shell. The Visual Studio terminal is built on top of Windows Terminal. To open the terminal in Visual Studio, choose View > Terminal.
Jun 11, 2021 Start in Visual Studio. Follow these steps to open Developer Command Prompt or Developer. You are writing one application in Visual Studio which accepts some command line parameter to do some operation. You pass command-line arguments to the program when it’s been invoked from the command line. But how did you do it from Visual Studio?
When you open one of the developer shells from Visual Studio, either as a separate app or in the Terminal window, it opens to the directory of your current solution (if you have a solution loaded). This behavior makes it convenient to run commands against the solution or its projects.
Both shells have specific environment variables set that enable you to use command-line developer tools more easily. After opening one of these shells, you can enter the commands for different utilities without having to know where they're located.
Popular commands | Description |
---|---|
MSBuild | Build a project or solution |
clrver | A .NET Framework tool for CLR |
ildasm | A .NET Framework tool for disassembler |
dotnet | A .NET CLI command |
dotnet run | A .NET CLI command |
CL | C/C++ compile tool |
NMAKE | C/C++ compile tool |
LIB | C/C++ build tool |
DUMPBIN | C/C++ build tool |
Start in Visual Studio
Follow these steps to open Developer Command Prompt or Developer PowerShell from within Visual Studio:
Open Visual Studio.
On the menu bar, choose Tools > Command Line > Developer Command Prompt or Developer PowerShell.
Start from Windows menu
Another way to start the shells is from the Start menu. You may have multiple command prompts, depending on the version of Visual Studio and any additional SDKs and workloads you've installed.
Windows 10
Select Start and scroll to the letter V.
Expand the Visual Studio 2019 folder.
Choose Developer Command Prompt for VS 2019 or Developer PowerShell for VS 2019.
Alternatively, you can start typing the name of the shell in the search box on the taskbar, and choose the result you want as the result list starts to display the search matches.
Windows 8.1
Go to the Start screen, by pressing the Windows logo key on your keyboard for example.
On the Start screen, press Ctrl+Tab to open the Apps list, and then press V. This brings up a list that includes all installed Visual Studio command prompts.
Choose Developer Command Prompt for VS 2019 or Developer PowerShell for VS 2019.
Windows 7
Choose Start and then expand All Programs.
Choose Visual Studio 2019 > Visual Studio Tools > Developer Command Prompt for VS 2019 or Developer PowerShell for VS 2019.
If you have other SDKs installed, such as the Windows 10 SDK or previous versions, you may see additional command prompts. Check the documentation for the individual tools to determine which version of the command prompt you should use.
How Do I Compile A Visual Studio Project From The Command-line?
Start from file browser
Usually, the shortcuts for the shells you have installed are placed in the Start Menu folder for Visual Studio, such as in %ProgramData%MicrosoftWindowsStart MenuProgramsVisual Studio 2019Visual Studio Tools. But if searching for the command prompt doesn't produce the expected results, you can try to manually locate the files on your machine.
Developer Command Prompt
Search for the name of the command prompt file, which is VsDevCmd.bat, or go to the Tools folder for Visual Studio, such as %ProgramFiles(x86)%Microsoft Visual Studio2019CommunityCommon7Tools (path changes according to your Visual Studio version, edition, and installation location).
Once you've located the command prompt file, open it by entering the following command in a regular command prompt window:
Or enter the following command in the Windows Run dialog box:
Tip
You'll need to edit the path to match your Visual Studio installation.
Developer PowerShell
Search for a PowerShell script file named Launch-VsDevShell.ps1, or go to the Tools folder for Visual Studio, such as %ProgramFiles(x86)%Microsoft Visual Studio2019CommunityCommon7Tools. (The path changes according to your Visual Studio version, edition, and installation location.) Once you've located the PowerShell file, run it by entering the following command at a Windows PowerShell or PowerShell 6 prompt:
By default, the Developer PowerShell that launches is configured for the Visual Studio installation whose install path the Launch-VsDevShell.ps1 file is located in.
Tip
The execution policy must be set in order for the cmdlet to run.
See also
Commands trigger actions in Visual Studio Code. If you have ever configured a keybinding, then you've worked with commands. Commands are also used by extensions to expose functionality to users, bind to actions in VS Code's UI, and implement internal logic.
Using Commands
VS Code includes a large set of built-in commands that you can use to interact with the editor, control the user interface, or perform background operations. Many extensions also expose their core functionality as commands that users and other extensions can leverage.
Programmatically executing a command
The vscode.commands.executeCommand
API programmatically executes a command. This lets you use VS Code's built-in functionality, and build on extensions such as VS Code's built-in Git and Markdown extensions.
The editor.action.addCommentLine
command, for example, comments the currently selected lines in the active text editor:
Some commands take arguments that control their behavior. Commands may also return a result. The API-like vscode.executeDefinitionProvider
command, for example, queries a document for definitions at a given position. It takes a document URI and a position as arguments, and returns a promise with a list of definitions:
To find available commands:
Command URIs
Commands URIs are links that execute a given command. They can be used as clickable links in hover text, completion item details, or inside of webviews.
A command URI uses the command
scheme followed by the command name. The command URI for the editor.action.addCommentLine
command, for example, is command:editor.action.addCommentLine
. Here's a hover provider that shows a link in the comments of the current line in the active text editor:
The list of arguments to the command is passed as a JSON array that has been properly URI encoded: The example below uses the git.stage
command to create a hover link that stages the current file:
You can enable command URIs in webviews by setting enableCommandUris
in the WebviewOptions
when the webview is created. Delphi car diagnostic software download 2017.
Creating new commands
Registering a command
vscode.commands.registerCommand
binds a command ID to a handler function in your extension:
The handler function will be invoked whenever the myExtension.sayHello
command is executed, be it programmatically with executeCommand
, from the VS Code UI, or through a keybinding.
Creating a user facing command
vscode.commands.registerCommand
only binds a command ID to a handler function. To expose this command in the Command Palette so it is discoverable by users, you also need a corresponding command contribution
in your extension's package.json
:
The commands
contribution tells VS Code that your extension provides a given command, and also lets you control how the command is displayed in the UI. Now our command will show up in the Command Palette:
We still need to call registerCommand
to actually tie the command ID to the handler. This means that if the user selects the myExtension.sayHello
command from the Command Palette but our extension has not been activated yet, nothing will happen. To prevent this, extensions must register an onCommand
activationEvent
for all user facing commands:
Visual Studio Command Line Git
Now when a user first invokes the myExtension.sayHello
command from the Command Palette or through a keybinding, the extension will be activated and registerCommand
will bind myExtension.sayHello
to the proper handler.
You do not need an onCommand
activation event for internal commands but you must define them for any commands that:
- Can be invoked using the Command Palette.
- Can be invoked using a keybinding.
- Can be invoked through the VS Code UI, such as through the editor title bar.
- Is intended as an API for other extensions to consume.
Controlling when a command shows up in the Command Palette
By default, all user facing commands contributed through the commands
section of the package.json
show up in the Command Palette. However, many commands are only relevant in certain circumstances, such as when there is an active text editor of a given language or when the user has a certain configuration option set.
The menus.commandPalette
contribution point lets you restrict when a command should show in the Command Palette. It takes the ID of the target command and a when clause that controls when the command is shown:
Now the myExtension.sayHello
command will only show up in the Command Palette when the user is in a Markdown file.
Enablement of commands
Commands support enablement via an enablement
property - its value is a when-clause. Enablement applies to all menus and to registered keybindings.
Note: There is semantic overlap between enablement
and the when
condition of menu items. The latter is used to prevent menus full of disabled items. For example, a command that analyzes a JavaScript regular expression should show when the file is JavaScript and be enabled only when the cursor is over a regular expression. The when
clause prevents clutter, by not showing the command for all other language files. Preventing cluttered menus is highly recommended.
Last, menus showing commands, like the Command Palette or context menus, implement different ways of dealing with enablement. Editor and explorer context menus render enablement/disablement items while the Command Palette filters them.
Visual Studio Command Line 2019
Using a custom when clause context
C# - Build Visual Studio Project Through The Command Line ..
If you are authoring your own VS Code extension and need to enable/disable commands, menus, or views by using a when
clause context and none of the existing keys suit your needs, then you can add your own context.
Developer Command Files And LocationsIf You Prefer To Set The Build Architecture Environment In An Existing Command Prompt Window, You Can Use One Of The Command Files (batch Files) Cr..
The first example below sets the key myExtension.showMyCommand
to true, which you can use in enablement of commands or with the when
property. The second example stores a value that you could use with a when
clause to check if the number of cool open things is greater than 2.