If you’ve just tried to install a .NET tool and got smacked with the dreaded error message: “Settings file ‘DotnetToolSettings.xml’ was not found in the package,” congratulations: You are today’s lucky recipient of yet another cryptic dotnet installer hiccup!
But don’t worry, we’re about to sort this nonsense out. Namely, this article explains a couple of things you can try out to possibly fix the issue.
Problem
You run:
dotnet tool install --global <ToolName>
And instead of getting the installation process you expected, you get hit with this aggravating error:
Settings file 'DotnetToolSettings.xml' was not found in the package.
So, what does this mean?
It’s the dotnet tool installer subtly telling you, “Yeah, I totally failed, but I won’t even tell you why in a way that makes sense.”
Good times!
In my case, the actual command (and the resulting error message) was:
Tool 'dotnet-ef' failed to update due to the following:
The settings file in the tool's NuGet package is invalid: Settings file 'DotnetToolSettings.xml' was not found in the package.
Tool 'dotnet-ef' failed to install. Contact the tool author for assistance.
Reason
This failure happens for two common reasons:
- Your .NET SDK is too old – Many recent versions of dotnet tools require the latest .NET SDK. If your SDK is outdated, the package installer might assume it should find
DotnetToolSettings.xml
, even though modern versions don’t use this file at all. Classic case of mismatched expectations. - NuGet feed issues – If your dotnet environment is configured to use multiple NuGet sources, it may be failing before it even reaches the correct package source. That could be due to authentication problems, connectivity issues, or because NuGet just enjoys making life difficult.
Solution
Step 1: Update Your .NET SDK
If your .NET SDK is outdated, save yourself from further misery by updating it. Check your current SDK version with:
dotnet --version
If you need an upgrade, do this:
Windows (using winget)
winget install Microsoft.DotNet.SDK.9
Replace
9
with whatever the latest SDK version is.macOS (using Homebrew)
brew update
brew install --cask dotnet-sdk
Alternatively, you can use:
brew upgrade dotnet-sdk
If Homebrew isn’t your thing (or if you need a preview version that’s not yet available), you can always grab the installer manually from the official .NET site.
Step 2: Fix NuGet Sources
Check which NuGet feeds your dotnet environment is using:
dotnet nuget list source
If you see failing private feeds, bypass them during installation:
dotnet tool install --global <ToolName> --ignore-failed-sources
This forces dotnet to ignore broken feeds and grab the package from a working one.
Step 3: Install an Older Version
If all else fails, you may need to install a specific tool version that works with your current SDK:
dotnet tool install --global <ToolName> --version <KnownWorkingVersion>
Sometimes, staying on the cutting edge is overrated—especially when new dependencies break everything. 🙃
Conclusion
This error is annoying, but fortunately, it’s fixable. Keep your .NET environment fresh, manage your NuGet feeds wisely, and remember that the installer doesn’t always tell the whole story.
Because why would it? That would be too easy. 😉
References
- https://stackoverflow.com/questions/74147084/cannot-install-anything-using-dotnet-tool-install-command
- https://github.com/dotnet/interactive/issues/3839
- https://dotnet.microsoft.com/en-us/download