Home > Enterprise >  How do I reinstall a globally installed dotnet package
How do I reinstall a globally installed dotnet package

Time:09-13

I have a nuget package that I installed the following way:

dotnet new --install Umbraco.Templates::10.2.0

Now, I've run into some issues with this package, and the only solution that I have found that I have not tried yet, is to remove and install the package again.

So I google how to do that. But the only things I can find is commands made for removing the package for a specific project. Can I somehow globally remove the package and then install it again the same way as I did before?

CodePudding user response:

That's a template, not a global package. The docs explain how custom templates work, how to create your own, install or uninstall a template using switches on the dotnet new command.

What this particular page is missing is how to check and apply template updates. This is done with the --update-check and --update-apply switches.

You can check if there are any template updates with :

dotnet new --update-check

You can apply new updates with

dotnet new --update-apply

You don't have to use --update-check before --update-apply.

You can use dotnet new --help to list all options of the dotnet new command

Reinstalling

Using dotnet new --install should remove the existing version and reinstall it. In .NET 7 this becomes dotnet new install :

dotnet new --install  Umbraco.Templates

If that doesn't work, the template can be uninstalled with uninstall and installed again :

dotnet new --uninstall  Umbraco.Templates
dotnet new --install  Umbraco.Templates

.NET 7

Starting with .NET 7 update becomes a subcommand.

To check and apply, use dotnet new update. That's what developers want most of the time.

To check for new versions, use add the --check-only or --dry-run switch :

dotnet new update --check-only
  • Related