SlnUp 2.1.0

dotnet tool install --global SlnUp --version 2.1.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local SlnUp --version 2.1.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SlnUp&version=2.1.0
nuke :add-package SlnUp --version 2.1.0

Visual Studio solution updater

This is a .NET tool that allows you to easily change the Visual Studio version information in a solution file using a Visual Studio version number.

CI Build codecov NuGet NuGet

Why?

The Visual Studio Version Selector tool, which determines which version of Visual Studio to open when you double-click a .sln file, uses the solution file header to determine which version of Visual Studio to open.

Updating a solution file with correct version information requires you to understand the solution file header and the Visual Studio version information.

How to use it

Install the tool

dotnet tool install -g SlnUp

Update the tool

dotnet tool update -g SlnUp

Run the tool

To view all available options, you can run:

slnup --help

The simplest form is to run the tool (slnup) from a directory containing a single solution (.sln) file. This will cause the tool to discover a solution file in the current directory and update it with the latest version.

slnup

You can also pass a Visual Studio product year (2017, 2019, or 2022) to update to the latest version for the specified product year.

slnup 2022

You can also specify a specific version of Visual Studio using a two-part (ex. 17.0) or three-part (17.1.0) version number:

slnup 17.0

A path to a solution file may also be specified using the -p or --path parameters. This will be necessary if there is more than one solution file in the current directory.

slnup 2022 --path ./path/to/solution.sln

If you want to specify the exact version information to be put into the solution file header, you can specify the version information like so:

slnup 17.0 --build-version 17.0.31903.59

How does it work?

Visual Studio solution files have a well known file header. The tool knows how to parse and update the solution file header and save the file. The tool also knows version information for builds of Visual Studio from Visual Studio 2017 to 2022. The version information specified, is used to update the file header.

Consider a solution file with the following file header:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28701.123
MinimumVisualStudioVersion = 10.0.40219.1

This solution file header was last updated using Visual Studio 16 (a.k.a. Visual Studio 2019) with build number 16.0.28701.123.

When you double click on a solution file like this, the Visual Studio Version Selector tool will attempt to locate an installed version of Visual Studio that most closely matches the version information. If Visual Studio 2019 is installed, that will likely be used to open the solution file.

Now, let's say you want to update the solution file to be opened with Visual Studio 2022. You could run the following to update the solution file with version information for Visual Studio 2022:

slnup 2022

In the case of 2022, the tool will use the latest known version information it knows for that version. So, this would cause the tool to update the solution file header to the following:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1

Now, when you double click on the updated solution file, the Visual Studio Version Selector tool will attempt to locate and open the solution file using Visual Studio 2022.

What is supported?

  • The tool supports updating solution files with file format version 12.00.
    • If the solution file does not contain a file format version, you will receive an error.
    • If the solution file header does not contain version information such as # Visual Studio Version 17, VisualStudioVersion = 17.0.31903.59, or MinimumVisualStudioVersion = 10.0.40219.1, then those values will be added to the file header.
  • The tool supports Visual Studio 2017, 2019, and 2022.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2.1.0 130 2/15/2024
2.0.0 264 11/14/2023
1.4.3 221 9/30/2023
1.4.2 225 5/27/2023
1.4.1 356 2/25/2023
1.4.0 342 11/25/2022
1.3.2 418 9/5/2022
1.3.1 484 8/10/2022
1.3.0 478 7/9/2022
1.2.1 411 6/8/2022
1.2.0 496 4/14/2022
1.1.0 430 3/10/2022
1.0.2 492 2/16/2022
1.0.1 246 1/15/2022
1.0.0 349 11/18/2021
1.0.0-alpha.31 142 11/18/2021
1.0.0-alpha.30 157 11/18/2021
1.0.0-alpha.29 159 11/18/2021
1.0.0-alpha.24 129 11/17/2021
1.0.0-alpha.23 134 11/17/2021
1.0.0-alpha.22 138 11/17/2021
1.0.0-alpha.21 145 11/17/2021