Skip to content

Add Aspire.Hosting.Dotnet integration package - #18442

Merged
Karol Zadora-Przylecki (karolz-ms) merged 8 commits into
mainfrom
dev/karolz/project-v2-s1
Jul 2, 2026
Merged

Add Aspire.Hosting.Dotnet integration package#18442
Karol Zadora-Przylecki (karolz-ms) merged 8 commits into
mainfrom
dev/karolz/project-v2-s1

Conversation

@karolz-ms

@karolz-ms Karol Zadora-Przylecki (karolz-ms) commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Adds Aspire.Hosting.Dotnet language integration package (making C# a sibling of Go/Python/Javascript). This is first part of "Project V2" workstream.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18442

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18442"

@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new experimental Aspire.Hosting.Dotnet language-integration package, making C# a sibling of the existing Go/Python/JavaScript language packages. It relocates CSharpAppResource and the AddCSharpApp extension methods out of core Aspire.Hosting, rebases CSharpAppResource from ProjectResource onto ExecutableResource (launched as dotnet run --project|--file), and extracts a shared internal IProjectLaunchDefaultsResource interface so the project-defaults wiring (Kestrel endpoints, launch-profile environment, ASPNETCORE URLs) can be reused by both core ProjectResource and the relocated CSharpAppResource. This is described as the first part of the "Project V2" workstream, with debug and publish/compute parity explicitly deferred.

Changes:

  • New Aspire.Hosting.Dotnet package: CSharpAppResource (now an ExecutableResource) and AddCSharpApp overloads that build the dotnet run command line, validate the path/SDK version, and apply project defaults.
  • New internal IProjectLaunchDefaultsResource abstraction implemented explicitly by both ProjectResource and CSharpAppResource; WithProjectDefaults and LaunchProfileExtensions generalized from ProjectResource to the interface/IResource.
  • Blazor gateway and its tests migrated to CSharpAppResource; CSharpApp tests relocated to a new Aspire.Hosting.Dotnet.Tests project (no test coverage lost).

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Aspire.Hosting.Dotnet/CSharpAppHostingExtensions.cs New relocated AddCSharpApp + polyglot dispatcher; builds dotnet run args and validation.
src/Aspire.Hosting.Dotnet/CSharpAppResource.cs Rebased resource on ExecutableResource; explicit IProjectLaunchDefaultsResource state impl.
src/Aspire.Hosting/ApplicationModel/IProjectLaunchDefaultsResource.cs New internal abstraction shared by core and the new package.
src/Aspire.Hosting/ApplicationModel/ProjectResource.cs Implements the new interface via private fields + explicit members.
src/Aspire.Hosting/ProjectResourceBuilderExtensions.cs WithProjectDefaults/helpers generalized to the interface; GetConfiguration uses .Single().
src/Shared/LaunchProfiles/LaunchProfileExtensions.cs Signatures widened ProjectResource → IResource (complete and consistent).
src/Aspire.Hosting.Blazor/BlazorGatewayExtensions.cs Gateway return/param types changed to CSharpAppResource.
src/Aspire.Hosting.Blazor/Aspire.Hosting.Blazor.csproj Adds Aspire.Hosting.Dotnet project reference.
src/Aspire.Hosting.Dotnet/README.md New package README following language-integration conventions.
tests/Aspire.Hosting.Dotnet.Tests/* New test project with relocated + new coverage (args, metadata, debugging, launch-profile, guards).
tests/Aspire.Hosting.Tests/ProjectResourceTests.cs, ResourceCommandAnnotationTests.cs Remove CSharpApp tests (relocated) and unused suppression pragma.
tests/Aspire.Hosting.Blazor.Tests/* Gateways switched to AddCSharpApp; add Aspire.Hosting.Dotnet reference + suppression.
Aspire.slnx Registers the new source and test projects.
docs/plans/project-v2-csharpprogram-watch.md Planning doc describing the staged workstream and intentional deferrals.

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 3 issues: 3 correctness/behavior regressions.

Comment thread src/Aspire.Hosting.Dotnet/DotnetProjectHostingExtensions.cs
Comment thread src/Aspire.Hosting.Dotnet/CSharpAppHostingExtensions.cs
Comment thread src/Aspire.Hosting.Dotnet/DotnetProjectResource.cs
Copilot AI review requested due to automatic review settings June 23, 2026 23:44
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Comment thread src/Aspire.Hosting.Dotnet/DotnetProjectHostingExtensions.cs
Copilot AI review requested due to automatic review settings June 23, 2026 23:59
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Comment thread src/Aspire.Hosting.Dotnet/CSharpAppHostingExtensions.cs
Comment thread src/Aspire.Hosting.Dotnet/CSharpAppResource.cs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@afscrome

Copy link
Copy Markdown
Collaborator

Probably not in scope for this PR, but would you expect the DotnetToolResource. (And maybe also EF) to move into this new Aspire.Hosting.Dotnet package?

Comment thread docs/plans/project-v2-csharpprogram-watch.md Outdated
Comment thread docs/plans/project-v2-csharpprogram-watch.md
@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings June 24, 2026 20:06
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.

Comment thread src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs
Comment thread src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs Outdated
Comment thread src/Aspire.Hosting.Dotnet/CSharpAppHostingExtensions.cs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

This comment has been minimized.

Co-authored-by: karolz-ms <15271049+karolz-ms@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

Comment thread src/Aspire.Hosting.Dotnet/DotnetProjectHostingExtensions.cs
Comment thread src/Aspire.Hosting/ApplicationModel/ProjectResource.cs Outdated
Comment thread src/Aspire.Hosting.Dotnet/DotnetProjectResource.cs Outdated
@github-actions

This comment has been minimized.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Comment thread src/Aspire.Hosting.Dotnet/DotnetProjectResource.cs
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Tests selector (audit mode)

The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement.

Runs the full test matrix + all jobs (ALL) — run-all fallback: '.markdownlintignore' is neither Layer-1-owned nor matched by a Layer 2 rule


Selection computed for commit 5a85faf.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated no new comments.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@karolz-ms

Copy link
Copy Markdown
Contributor Author

I have done multiple rounds of AI code reviews and PR testing for this PR and believe all issues have been addressed.

Comment thread docs/plans/project-v2-csharpprogram-watch.md
Comment thread src/Aspire.Hosting.Blazor/BlazorGatewayExtensions.cs

@davidfowl David Fowler (davidfowl) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a playground sample that uses this new resoruce type.

@karolz-ms

Copy link
Copy Markdown
Contributor Author

We need a playground sample that uses this new resource type.

I will add the playground sample and new .NET Functions resource to the feature plan in my next PR.

@karolz-ms
Karol Zadora-Przylecki (karolz-ms) merged commit 435f5d0 into main Jul 2, 2026
656 of 661 checks passed
@karolz-ms
Karol Zadora-Przylecki (karolz-ms) deleted the dev/karolz/project-v2-s1 branch July 2, 2026 16:19
@github-actions github-actions Bot added this to the 13.5 milestone Jul 2, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

⚠️ Documentation was required for this change, but a docs PR could not be drafted automatically.

Documentation was required and all content was authored and committed to branch docs/aspire-hosting-dotnet-integration on microsoft/aspire.dev, but the create_pull_request safe-output tool failed twice with "Pinned SHA ... failed to generate patch: ERR_SYSTEM: Git command failed with status 1" — a shallow-clone infrastructure error that prevented the draft PR from being opened.

Triggered signals (6): new_hosting_integration_project, new_package_added, new_public_type, integration_readme_changed, experimental_attribute_added, target_framework_changed — all pointing to the new Aspire.Hosting.Dotnet package and its AddDotnetProject / DotnetProjectResource public API.

Documentation authored (needs manual PR):

  • src/frontend/src/content/docs/integrations/dotnet/dotnet-project-hosting.mdx — new reference page for AddDotnetProject (package install, C# & TypeScript examples, path types, file-based app prerequisites, dependencies, launch profile config, diagnostic suppression, comparison table)
  • src/frontend/src/content/docs/diagnostics/aspiredotnetproject001.mdx — diagnostics reference for ASPIREDOTNETPROJECT001
  • src/frontend/config/sidebar/integrations.topics.ts — sidebar entry for the new page

See the workflow run for details: https://github.com/microsoft/aspire/actions/runs/28605119390

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants