dotnet new templates

Path

Where are the template packages stored for dotnet new? I had to run a good old file seach in my C: drive for this. They are stored in a path under the user profile, per SDK version.

On Windows it's something like this:

C:\Users\<username>\.templateengine\dotnetcli\<sdkversion>\packages

%userprofile%\.templateengine\dotnetcli\v3.1.402\packages

In that folder you can also see the version of the packages/template.

Updating via NuGet.Org

To update your local templates that have NuGet.org as their source, you can use these command to check and update all at once:

dotnet new --update-check
dotnet new --update-apply

Updating via custom package source

Unfortunately these commands won't work to update templates that where installed from a custom source, i.e. Azure Artifacts.

Only thing I have found to work is to install the template again. That will download a new version. An example for installing and updating(!) a custom template package:

dotnet new --install "fsociety.templates" --nuget-source https://pkgs.dev.azure.com/fsociety/_packaging/feedname/nuget/v3/index.json

If you check the .templateengine folder, you'll see the latest .nupkg is there.

I don't think there is a solution to update all templates at once when they are installed from a custom source. If you know one, please share in the comments.