Skip to main content

Fixing the "Newer version of Aspire.Hosting.AppHost required" error

After pulling some NuGet packages into my .NET Aspire project, I ran into this cryptic startup failure:


Aspire.Hosting.DistributedApplicationException: Newer version of the
Aspire.Hosting.AppHost package is required to run the application.
Ensure you are referencing at least version '13.2.2'.

   at Aspire.Hosting.Dcp.DcpDependencyCheck.EnsureDcpVersion(DcpInfo dcpInfo)
   at Aspire.Hosting.Dcp.DcpDependencyCheck.GetDcpInfoAsync(...)
   at Aspire.Hosting.Dcp.DcpHost.StartAsync(...)

The app host refuses to start, and the logs point you toward a version check deep inside DCP internals.

The error message tells me that a minimum version of the hosting package is required,but no matter how many times I randotnet restore or update NuGet packages through Visual Studio, the error persists. That's because there are two places that pin the Aspire version.

Why updating NuGet packages isn't enough

Aspire AppHost projects use a special SDK reference at the very top of the .csproj file — separate from the <PackageReference> items in the ItemGroup. This SDK reference controls how MSBuild loads the Aspire tooling before your packages are even considered. The DCP (Developer Control Plane) version check validates against the SDK version, not the NuGet version — so an outdated SDK reference will always fail, regardless of what your packages say.

Two things that must match: the Project Sdk="Aspire.AppHost.Sdk/x.x.x" attribute at the top of the csproj, and the PackageReference versions inside it. Both need to be bumped together.

The fix

Once you know this, the fix is easy:

  1. Update your NuGet packages as usual  via the NuGet manager in Visual Studio or dotnet add package.
  2. Open your *.AppHost.csproj file and look at the very first line; the Project element's Sdk attribute.
  3. Update the version number in Sdk="Aspire.AppHost.Sdk/..." to match the Aspire version you're targeting.

Here is an example for my project:

The first line is what I missed to update. The version in the Sdk attribute must be updated manually. It is not touched by NuGet restore or package update tooling.

Going forward

Whenever you upgrade .NET Aspire, treat it as a two-part update: bump all the Aspire.* NuGet packages and update the Aspire.AppHost.Sdk version in your csproj. Keeping these in sync will save you from a confusing startup failure every single time a new Aspire release lands.

Popular posts from this blog

Podman– Command execution failed with exit code 125

After updating WSL on one of the developer machines, Podman failed to work. When we took a look through Podman Desktop, we noticed that Podman had stopped running and returned the following error message: Error: Command execution failed with exit code 125 Here are the steps we tried to fix the issue: We started by running podman info to get some extra details on what could be wrong: >podman info OS: windows/amd64 provider: wsl version: 5.3.1 Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:2655: connectex: No connection could be made because the target machine actively refused it. That makes sense as the podman VM was not running. Let’s check the VM: >podman machine list NAME         ...

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.

Cleaner switch expressions with pattern matching in C#

Ever find yourself mapping multiple string values to the same result? Being a C# developer for a long time, I sometimes forget that the C# has evolved so I still dare to chain case labels or reach for a dictionary. Of course with pattern matching this is no longer necessary. With pattern matching, you can express things inline, declaratively, and with zero repetition. A small example I was working on a small script that should invoke different actions depending on the environment. As our developers were using different variations for the same environment e.g.  "tst" alongside "test" , "prd" alongside "prod" .  We asked to streamline this a long time ago, but as these things happen, we still see variations in the wild. This brought me to the following code that is a perfect example for pattern matching: The or keyword here is a logical pattern combinator , not a boolean operator. It matches if either of the specified pattern...