Skip to content

Repository files navigation

Icon dnx vs

VersionDownloadsLicenseCI StatusCI Version

Run with:

dnx vs -- [command] [options]

To get the CI version:

dnx vs --prerelease --source https://pkg.kzu.app/index.json -- [command] [options]

A global tool for running, managing and querying Visual Studio installations

Supports switches in all the following forms: -flag, --flag, /flag, -flag=value, --flag=value, -flag:value, --flag:value, and bare channel/SKU/workload shortcuts.

Supported commands:

alias

Shows the list of saved aliases

Usage: dnx vs -- alias [options]

All built-in commands support a -save:[alias] option that will cause the command to be saved with that alias. From that point on, it's possible to just run the command (including all saved arguments) by just running the alias instead.

Examples:

# Save the first VS enterprise with the Maui/Mobile workload as the "mobile" alias
> dnx vs -- -sku:ent -first +mobile -save:mobile
# Runs the saved alias with all the original arguments
> dnx vs -- mobile

client

Launches Visual Studio in client mode

Usage: dnx vs -- client [options]
OptionDescription
stableRun stable version
insidersRun insiders version
int|internalRun internal (aka 'dogfood') version
skuEdition, one of e|ent|enterprise, p|pro|professional, c|com|community, b|build|buildtools or t|test|testagent
filterExpression to filter VS instances. E.g. x => x.InstanceId = '123'
exp|experimentalRun experimental instance instead of regular.
firstRun first matching instance.
w|workspaceIdThe workspace ID to connect to

config

Opens the config folder.

Usage: dnx vs -- config [options]
OptionDescription
stableopen stable version
insidersopen insiders version
int|internalopen internal (aka 'dogfood') version
skuEdition, one of e|ent|enterprise, p|pro|professional, c|com|community, b|build|buildtools or t|test|testagent
filterExpression to filter VS instances. E.g. x => x.InstanceId = '123'
exp|experimentalopen experimental instance instead of regular.
firstopen first matching instance.

install

Installs a specific edition of Visual Studio.

Usage: dnx vs -- install [options]
OptionDescription
stableinstall stable version
insidersinstall insiders version
int|internalinstall internal (aka 'dogfood') version
skuEdition, one of e|ent|enterprise, p|pro|professional, c|com|community, b|build|buildtools or t|test|testagent
filterExpression to filter VS instances. E.g. x => x.InstanceId = '123'
nick|nicknameOptional nickname to use
v|versionInstall specific (semantic) version, such as 18.7 or 18.7.3
addA workload ID

You can add specific workload IDs by using the supported workload switches using the + prefix.

See the documentation for the Visual Studio installer command line options for the full list of arguments that can be provided.

Common options are --passive, quiet and --wait, for example.

Examples:

# Installs VS enterprise with the Maui/Mobile workload
# Note the -sku: switch/prefix is optional
> dnx vs -- install Enterprise +mobile
# Install VS community with the .NET Core, ASP.NET and Azure workloads, # shows installation progress and waits for it to finish before returning
> dnx vs -- install +core +web +azure
# Install VS 18 Enterprise
> dnx vs -- install -v:18 -sku:ent
# Install the latest VS 17 (2022) Community
> dnx vs -- install --version 17

kill

Kills running devenv processes.

Usage: dnx vs -- kill [options]
OptionDescription
stablekill stable version
insiderskill insiders version
int|internalkill internal (aka 'dogfood') version
skuEdition, one of e|ent|enterprise, p|pro|professional, c|com|community, b|build|buildtools or t|test|testagent
filterExpression to filter VS instances. E.g. x => x.InstanceId = '123'
exp|experimentalkill experimental instance instead of regular.
firstkill first matching instance.
allkill all instances.

Examples:

# Kill all running instances of Visual Studio
> dnx vs -- kill all

log

Opens the folder containing the Activity.log file.

Usage: dnx vs -- log [options]
OptionDescription
stableopen stable version
insidersopen insiders version
int|internalopen internal (aka 'dogfood') version
skuEdition, one of e|ent|enterprise, p|pro|professional, c|com|community, b|build|buildtools or t|test|testagent
filterExpression to filter VS instances. E.g. x => x.InstanceId = '123'
exp|experimentalopen experimental instance instead of regular.
firstopen first matching instance.

modify

Modifies an installation of Visual Studio.

Usage: dnx vs -- modify [options]
OptionDescription
stablemodify stable version
insidersmodify insiders version
int|internalmodify internal (aka 'dogfood') version
skuEdition, one of e|ent|enterprise, p|pro|professional, c|com|community, b|build|buildtools or t|test|testagent
filterExpression to filter VS instances. E.g. x => x.InstanceId = '123'
firstmodify first matching instance.
addA workload ID
removeA workload ID

A shorthand notation is available for add|remove [workload ID] via the supported workload ID switches/aliases, using the + (for add) and - (for remove) prefixes.

Examples:

# Add .NET Core Workload to installed Visual Studio Preview
> dnx vs -- modify insiders +core

run

This is default command, so typically it does not need to be provided as an argument.

Usage: dnx vs -- run [options]
OptionDescription
stablerun stable version
insidersrun insiders version
int|internalrun internal (aka 'dogfood') version
skuEdition, one of e|ent|enterprise, p|pro|professional, c|com|community, b|build|buildtools or t|test|testagent
filterExpression to filter VS instances. E.g. x => x.InstanceId = '123'
exp|experimentalrun experimental instance instead of regular.
idRun a specific instance by its ID
f|firstIf more than one instance matches the criteria, run the first one sorted by descending build version.
v|versionRun specific (semantic) version, such as 18.7 or 18.7.3
w|waitWait for the started Visual Studio to exit.
nr|nodereuseDisable MSBuild node reuse. Useful when testing analyzers, tasks and targets. Defaults to true when running experimental instance.
defaultSet as the default version to run when no arguments are provided, or remove the current default (with --default-).
requiresA workload ID

All workload switches are available too to filter the instance to run, including using the + prefix/alias syntax.

This command will remember the last VS that was located and run. So the next time you can just run the same instance by simply using dnx vs (since run is the default command and can be omitted).

Examples:

# Runs the first VS enterprise with the Maui/Mobile workload
> dnx vs -- -sku:ent -first +mobile
# Runs VS 18.7
> dnx vs -- -v:18.7
# Runs VS 18 Insiders
> dnx vs -- -v:18 -insiders
# Runs the last VS that was run
> dnx vs

update

Updates an installation of Visual Studio.

Usage: dnx vs -- update [options]
OptionDescription
stableUpdate stable version
insidersUpdate insiders version
int|internalUpdate internal (aka 'dogfood') version
skuEdition, one of e|ent|enterprise, p|pro|professional, c|com|community, b|build|buildtools or t|test|testagent
filterExpression to filter VS instances. E.g. x => x.InstanceId = '123'
firstUpdate first matching instance.
allUpdate all instances.
v|versionUpdate specific (semantic) version, such as 18.7 or 18.7.3

Examples:

# Update the installed VS 18.7 instance
> dnx vs -- update -v:18.7
# Update all matching VS 17 instances
> dnx vs -- update --version 17 --all

where

Locates the installed version(s) of Visual Studio that satisfy the requested requirements, optionally retrieving installation properties from it.

Usage: dnx vs -- where [options]
OptionDescription
stableshow stable version
insidersshow insiders version
int|internalshow internal (aka 'dogfood') version
skuEdition, one of e|ent|enterprise, p|pro|professional, c|com|community, b|build|buildtools or t|test|testagent
filterExpression to filter VS instances. E.g. x => x.InstanceId = '123'
firstshow first matching instance.
prop|propertyThe name of a property to return
listShows result as a list
requiresA workload ID

Supports same options as vswhere.exe:

 -all Finds all instances even if they are incomplete and may not launch.
-prerelease Also searches prereleases. By default, only releases are searched.
-products arg One or more product IDs to find. Defaults to Community, Professional, and Enterprise.
Specify "*" by itself to search all product instances installed.
See https://aka.ms/vs/workloads for a list of product IDs.
-requires arg One or more workload or component IDs required when finding instances.
All specified IDs must be installed unless -requiresAny is specified.
See https://aka.ms/vs/workloads for a list of workload and component IDs.
-requiresAny Find instances with any one or more workload or components IDs passed to -requires.
-version arg A version range for instances to find. Example: [15.0,16.0) will find versions 15.*.
-latest Return only the newest version and last installed.
-sort Sorts the instances from newest version and last installed to oldest.
When used with "find", first instances are sorted then files are sorted lexigraphically.
-legacy Also searches Visual Studio 2015 and older products. Information is limited.
This option cannot be used with either -products or -requires.
-format arg Return information about instances found in a format described below.
-property arg The name of a property to return. Defaults to "value" format.
Use delimiters ".", "/", or "_" to separate object and property names.
Example: "properties.nickname" will return the "nickname" property under "properties".
-include arg One or more extra properties to include, as described below.
-find arg Returns matching file paths under the installation path. Defaults to "value" format.
The following patterns are supported:
? Matches any one character except "\".
* Matches zero or more characters except "\".
** Searches the current directory and subdirectories for the remaining search pattern.
-nologo Do not show logo information. Some formats noted below will not show a logo anyway.
-utf8 Use UTF-8 encoding (recommended for JSON).
-?, -h, -help Display this help message.
Extra properties:
packages Return an array of packages installed in this instance.
Supported only by the "json" and "xml" formats.
Formats:
json An array of JSON objects for each instance (no logo).
text Colon-delimited properties in separate blocks for each instance (default).
value A single property specified by the -property parameter (no logo).
xml An XML data set containing instances (no logo).

A shorthand notation is available for -requires [workload ID] via the supported workload ID switches, using the + prefix (see below).

See also vswhere on GitHub.

Workload ID switches

For commands that receive workload ID switches (i.e. dnx vs -- where -requires [WORKLOAD_ID] or dnx vs -- install --add [WORKLOAD_ID]), the following aliases are available:

AliasWorkload ID
mobileMicrosoft.VisualStudio.Workload.NetCrossPlat
xamarinMicrosoft.VisualStudio.Workload.NetCrossPlat
mauiMicrosoft.VisualStudio.Workload.NetCrossPlat
coreMicrosoft.NetCore.Component.DevelopmentTools
azureMicrosoft.VisualStudio.Workload.Azure
dataMicrosoft.VisualStudio.Workload.Data
desktopMicrosoft.VisualStudio.Workload.ManagedDesktop
unityMicrosoft.VisualStudio.Workload.ManagedGame
nativeMicrosoft.VisualStudio.Workload.NativeDesktop
vcMicrosoft.VisualStudio.Workload.VCTools
webMicrosoft.VisualStudio.Workload.NetWeb
nodeMicrosoft.VisualStudio.Workload.Node
officeMicrosoft.VisualStudio.Workload.Office
pyMicrosoft.VisualStudio.Workload.Python
pythonMicrosoft.VisualStudio.Workload.Python
uwpMicrosoft.VisualStudio.Workload.Universal
vsxMicrosoft.VisualStudio.Workload.VisualStudioExtension

The aliases are converted to the appropriate switch automatically, such as into -requires [ID] or --add [ID]. Additionally, depending on the command being run, the aliases might use a + prefix (like +mobile), which might make for a more intuitive command line, such as dnx vs -- install +mobile -sku:enterprise or dnx vs -- +mobile (runs the VS with the mobile workload installed). The modify command uses + and - prefix to add or remove workloads respectively, for example.

See the full list of workload and component IDs.


Open Source Maintenance Fee

To ensure the long-term sustainability of this project, users of this package who generate revenue must pay an Open Source Maintenance Fee. While the source code is freely available under the terms of the License, this package and other aspects of the project require adherence to the Maintenance Fee.

To pay the Maintenance Fee, become a Sponsor at the proper OSMF tier. A single fee covers all of Devlooped packages.


Sponsors

Clarius OrgMFB Technologies, Inc.SandRockDRIVE.NET, Inc.Keith PickfordThomas BolonKori FrancisReuben SwartzJacob FosheeEric JohnsonJonathan Ken BonnySimon Croppagileworks-euZheyu ShenVezelChilliCream4OTCdomischellAdrian AlonsotorutekRyan McCafferySeika LogicielAndrew Granteska-gmbhGeodata AS

Sponsor this project

Learn more about GitHub Sponsors

About

A global tool for managing Visual Studio installations

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

50 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages