Configure Visual Studio across your organization with .vsconfig

Heath Stewart

As application requirements grow more complex, so do our solutions. Keeping developers’ environments configured across our organizations grows equally complex. Developers need to install specific workloads and components in order to build a solution. Some organizations add these requirements to their README or CONTRIBUTING documents in their repositories. Some organizations might publish these requirements in documents for new hires or even just forward emails. Configuring your development environment often becomes a day-long chore. What’s really needed is a declarative authoring model that just configures Visual Studio like you need it.

In Visual Studio 2017 Update 15.9 we added the ability to export and import workload and component selection to a Visual Studio installation configuration file. Developers can import these files into new or existing installations. Checking these files into your source repos makes them easy to share. However, developers still need to import these to get the features they need.

Automatically install missing components

New in Visual Studio 2019: you can save these files as .vsconfig files in your solution root directory and when the solution (or solution directory) is opened, Visual Studio will automatically detect which components are missing and prompt you to install them.

Installing missing components

You can find an example of this in the vswhere repo on GitHub. When you click the Install link, you’re prompted to install any missing components. You can click the View full installation details link if you’d like to select additional components.

Install missing components Installing missing components

Exporting your configuration

In Visual Studio 2019, you can create a .vsconfig file right from Solution Explorer:

  1. Right-click on your solution.
  2. Click Add > Installation Configuration File
  3. Confirm the location where you want to save the .vsconfig file (defaults to your solution root directory).
  4. Click Review details
  5. Select or deselect any changes you want to make and click Export

To help keep the installation footprint minimal, only export those components you know you need to build, test, and possibly publish your solution. One way you can do this is to install a second instance of Visual Studio or install into a virtual machine, add those workloads and optional components you know are necessary, and build and test your solution. Add components as needed until the solution builds successfully, then export your configuration.

For more details, see our documentation.

Feedback

We love to hear your feedback! You can report a problem or make suggestions for this or any other feature in Visual Studio on our Developer Community site.

 

18 comments

Discussion is closed. Login to edit/delete existing comments.

  • Guilherme Borges Cunha 0

    Is it a new feature on VS2019 only? I’ve installed the 2017 version and couldn’t find the option “Installation configuration file”

  • Dean Jackson 0

    What happened to this blog? Where’s the “setup” blog?

Feedback usabilla icon