Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

You must install or update .NET to run this application

I have a WebAPI project and I do a post-build process that calls "swagger.exe", which is a tool provided by NuGet Package. To install globally it, I used the following command:

dotnet tool install -g --version 5.3.1 Swashbuckle.AspNetCore.Cli

The problem is: My CI process was working fine yesterday. Today it doesn't work anymore. I narrowed down the problem to the swagger executable... Just by calling it, without any parameters, it returns the following message:

Terminal screenshot

You must install or update .NET to run this application.

App: C:\Users\DRibeiro\.dotnet\tools\swagger.exe
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '3.1.27' (x64)
.NET location: C:\Program Files\dotnet\

The following frameworks were found:
  3.1.21 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  3.1.26 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  5.0.12 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  5.0.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Notice that I have the Runtime 3.1.26 installed on my Windows.

Notice, also, that the Swashbuckle.AspNetCore.Cli version 5.3.1 was released in 2020! More than 2 years ago! NuGet Screenshot

So, the question is: Why this Package from 2020 requires a .NET Runtime released 2 weeks ago? Why can't it use one of the other Runtimes that I already have (and was working fine yesterday) ?

I know that I could just install the newer version and the problem would be solved... Just want to keep my CI's running smoothly without having to fix it every time a new Runtime version is released.

like image 994
Daniel Ribeiro Avatar asked Sep 08 '25 16:09

Daniel Ribeiro


1 Answers

Answer for modern .NET

Add --roll-forward LatestMajor to arguments of dotnet or set DOTNET_ROLL_FORWARD=LatestMajor environment variable.

--roll-forward

like image 58
SupinePandora43 Avatar answered Sep 10 '25 08:09

SupinePandora43