AspireHostingSDKVersion is empty in project-file properties for package-based AppHosts

Open Beginner friendly
#22,389 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@joperezr is already working on this.

Since Nov 24, 2026.

  • #22454 by @DamianEdwards — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
build-system

Research direction

Start in the Aspire.Hosting.AppHost package: compare where AspireHostingSDKVersion is set in Aspire.Hosting.AppHost.targets against the IsAspireHost-keyed defaults already in Aspire.Hosting.AppHost.props. Reproduce with the reported dotnet msbuild -getProperty:AspireHostingSDKVersion -getProperty:VersionedDir on the sample project, then move or mirror the definition into the .props file so it evaluates before the project body. Done when VersionedDir resolves with the version and, if it stays in .targets, the migration docs note the ordering change.

Written by the indexing model from the issue text.

Description

area-acquisition triage:bot-seen triage:needs-human

With the package-based AppHost (Microsoft.NET.Sdk + Aspire.Hosting.AppHost), AspireHostingSDKVersion is set in Aspire.Hosting.AppHost.targets. The obsolete Aspire.AppHost.Sdk set it in Sdk.props. Because the package sets it after the project body is evaluated, any property in the project file that uses it gets an empty value. Migrating off the SDK silently changes what those properties evaluate to.

Repro (17.0.0):

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net11.0</TargetFramework>
    <VersionedDir>obj/aspire/$(AspireHostingSDKVersion)</VersionedDir>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Aspire.Hosting.AppHost" Version="17.0.0" />
  </ItemGroup>
</Project>
$ dotnet msbuild -getProperty:AspireHostingSDKVersion -getProperty:VersionedDir
"AspireHostingSDKVersion": "17.0.0",
"VersionedDir": "obj/aspire/"

The same property worked under Aspire.AppHost.Sdk. I hit it with a version-pinned AspireCliBundlePath like the one above, and the build doesn't warn. The workaround is explicit Sdk.props/Sdk.targets imports, with the property defined after Sdk.targets.

Could the package define it in Aspire.Hosting.AppHost.props, keyed off IsAspireHost like the existing defaults there? If it has to stay in .targets, a mention in the migration docs would help.

Dominant language
C#
Stars
6.4k
Forks
1k
Avg merge
2d 9h
Merged PRs (30d)
446

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/aspire

All issues in microsoft/aspire

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.