Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ jobs:
timeout-minutes: 10
shell: pwsh
run: |
[xml] $appHost = Get-Content dev/EssentialCSharp.Web.AppHost/EssentialCSharp.Web.AppHost.csproj
$aspireVersion = $appHost.Project.Sdk.Version
$aspireVersion = (Get-Content aspire.config.json -Raw | ConvertFrom-Json).sdk.version
if (-not $aspireVersion) { throw "aspire.config.json does not define sdk.version." }
$installer = "$env:RUNNER_TEMP/aspire-install.sh"
Invoke-WebRequest https://aspire.dev/install.sh -OutFile $installer
bash $installer --version $aspireVersion --install-path "$HOME/.aspire/bin" --skip-path
Expand Down
15 changes: 8 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
<PackageVersion Include="ContentFeedNuget" Version="$(ToolingPackagesVersion)" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Aspire.Hosting" Version="13.6.5" />
<PackageVersion Include="Aspire.Hosting" Version="17.0.0" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="17.0.0" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="13.6.5" />
<PackageVersion Include="Aspire.Hosting.SqlServer" Version="13.6.5" />
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="13.6.5" />
<PackageVersion Include="Aspire.Hosting.Browsers" Version="13.6.5-preview.1.26559.7" />
<PackageVersion Include="Aspire.Hosting.EntityFrameworkCore" Version="13.6.5-preview.1.26559.7" />
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Ollama" Version="13.6.1" />
<PackageVersion Include="Aspire.Hosting.Dotnet" Version="17.0.0" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="17.0.0" />
<PackageVersion Include="Aspire.Hosting.SqlServer" Version="17.0.0" />
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="17.0.0" />
<PackageVersion Include="Aspire.Hosting.Browsers" Version="17.0.0-preview.1.26567.5" />
<PackageVersion Include="Aspire.Hosting.EntityFrameworkCore" Version="17.0.0-preview.1.26567.5" />
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Ollama" Version="17.0.0-beta.1052" />
<PackageVersion Include="TUnit.Aspire" Version="1.77.0" />
<PackageVersion Include="Azure.Extensions.AspNetCore.DataProtection.Keys" Version="1.6.5" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="10.0.15" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ItemGroup>
<PackageReference Include="Aspire.Hosting" />
<PackageReference Include="Aspire.Hosting.Browsers" />
<PackageReference Include="Aspire.Hosting.Dotnet" />
<PackageReference Include="Aspire.Hosting.EntityFrameworkCore" />
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Ollama" />
</ItemGroup>
Expand Down
12 changes: 7 additions & 5 deletions EssentialCSharp.Web.Hosting/WebHostingExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Aspire.Hosting;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Dotnet;
using Microsoft.Extensions.Configuration;

namespace EssentialCSharp.Web.Hosting;
Expand All @@ -17,7 +18,7 @@ public static class WebHostingExtensions
/// <param name="webDatabase">The existing SQL database connection resource.</param>
/// <param name="vectorDatabase">The existing PostgreSQL database connection resource.</param>
/// <returns>The Web resource, available for caller-specific configuration.</returns>
public static IResourceBuilder<ProjectResource> AddEssentialCSharpWeb(
public static IResourceBuilder<DotnetProjectResource> AddEssentialCSharpWeb(
this IDistributedApplicationBuilder builder,
string webProjectPath,
IResourceBuilder<IResourceWithConnectionString> webDatabase,
Expand All @@ -43,7 +44,8 @@ public static IResourceBuilder<ProjectResource> AddEssentialCSharpWeb(
"and set the AccessToNugetFeed environment variable to true before building and starting Aspire.");
}

var web = builder.AddProject("essentialcsharp-web", webProjectPath, launchProfileName: null)
var web = builder.AddDotnetProject(
"essentialcsharp-web", webProjectPath, options => options.ExcludeLaunchProfile = true)
.WithReference(webDatabase, connectionName: "EssentialCSharpWebContextConnection")
.WithReference(vectorDatabase, connectionName: "PostgresVectorStore")
.WaitFor(webDatabase)
Expand Down Expand Up @@ -77,8 +79,8 @@ public static IResourceBuilder<ProjectResource> AddEssentialCSharpWeb(
}

/// <summary>Applies local AI policy; AppHost Azure/Foundry configuration takes precedence over Ollama.</summary>
public static IResourceBuilder<ProjectResource> WithEssentialCSharpLocalAI(
this IResourceBuilder<ProjectResource> web)
public static IResourceBuilder<DotnetProjectResource> WithEssentialCSharpLocalAI(
this IResourceBuilder<DotnetProjectResource> web)
{
ArgumentNullException.ThrowIfNull(web);
var builder = web.ApplicationBuilder;
Expand Down Expand Up @@ -134,7 +136,7 @@ public static IResourceBuilder<ProjectResource> WithEssentialCSharpLocalAI(
// environment (including connection strings) once Web starts after migration completion. Give only the
// resources created by AddEFMigrations equivalent but independent annotations.
private static void IsolateSharedEnvironmentCallbacks(
ProjectResource web, IEnumerable<IResource> migrationResources)
DotnetProjectResource web, IEnumerable<IResource> migrationResources)
{
var webCallbacks = web.Annotations.OfType<EnvironmentCallbackAnnotation>()
.ToHashSet(ReferenceEqualityComparer.Instance);
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ For information on setting up your local development environment, please see the
### Standalone Aspire development

Only this repository is required. Install the .NET SDK selected by `global.json`, Node.js/npm,
the [Aspire CLI](https://aspire.dev/get-started/install-cli/), and a Docker-compatible container runtime.
the [Aspire CLI](https://aspire.dev/get-started/install-cli/) version pinned by `sdk.version` in
`aspire.config.json` (`aspire update --self` upgrades an existing install), and a Docker-compatible container runtime.
Start the container runtime first. The single root solution includes the application, hosting
library, AppHost, and all tests. The production Dockerfile restores, builds, and publishes only
the Web project and its dependencies, without loading the Aspire projects.
Expand All @@ -31,6 +32,11 @@ and optional Ollama use persistent data volumes; restart with the same command t
The AppHost has its own `UserSecretsId`, separate from ordinary Web application secrets.
SQL Server passwords are generated by Aspire unless an AppHost `Parameters:sqlserver-password`
secret is supplied. Stop only this AppHost using `aspire stop --apphost` with the same project path.
Add `--format mermaid` to `aspire describe` to print the resource dependency graph as a Mermaid diagram.

The Web resource uses Aspire's Project v2 model (`AddDotnetProject`), which the AppHost builds
before launch. Aspire watch [is not yet implemented for Project v2 resources](https://aspire.dev/integrations/dotnet/migrate-dotnet-project-resource/#check-workflows-before-migrating);
after changing Web code, rebuild just that resource with `aspire resource essentialcsharp-web rebuild --apphost <path>`.

Local AI defaults to Ollama (`qwen2.5-coder:7b`, approximately 5 GB download); local vector search
is not enabled. Disable model downloads before starting when chat is unnecessary:
Expand Down
3 changes: 3 additions & 0 deletions aspire.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"appHost": {
"path": "dev/EssentialCSharp.Web.AppHost/EssentialCSharp.Web.AppHost.csproj"
},
"sdk": {
"version": "17.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Aspire.Hosting;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Dotnet;
using Aspire.Hosting.Testing;
using EssentialCSharp.Web.Areas.Identity.Data;
using EssentialCSharp.Web.Data;
Expand Down Expand Up @@ -41,7 +42,7 @@ protected override void ConfigureBuilder(IDistributedApplicationTestingBuilder b
{
base.ConfigureBuilder(builder);

ProjectResource web = builder.Resources.OfType<ProjectResource>().Single(resource => resource.Name == WebResource);
DotnetProjectResource web = builder.Resources.OfType<DotnetProjectResource>().Single(resource => resource.Name == WebResource);
Uri chatModelEndpoint = ChatModel.Endpoint;
Uri hCaptchaApi = HCaptcha.ApiBaseUrl;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="Aspire.AppHost.Sdk" Version="13.6.5" />
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType>
Expand All @@ -10,10 +9,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" />
<PackageReference Include="Aspire.Hosting.Dotnet" />
<PackageReference Include="Aspire.Hosting.SqlServer" />
<PackageReference Include="Aspire.Hosting.PostgreSQL" />
<!-- Building the AppHost restores and builds Web before EF's no-build startup update. -->
<ProjectReference Include="..\..\EssentialCSharp.Web\EssentialCSharp.Web.csproj" />
<ProjectReference Include="..\..\EssentialCSharp.Web\EssentialCSharp.Web.csproj"
IsAspireProjectResource="true"
ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\EssentialCSharp.Web.Hosting\EssentialCSharp.Web.Hosting.csproj"
IsAspireProjectResource="false" />
</ItemGroup>
Expand Down
27 changes: 5 additions & 22 deletions docs/coding-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,17 @@ The standalone `run-tests` skill is intentionally not vendored: it refers to `fi
`.github/workflows/copilot-setup-steps.yml` prepares the cloud agent environment and is also
used by Copilot code review while no separate `copilot-code-review.yml` workflow exists.
Setup uses the [official Aspire install script](https://aspire.dev/get-started/install-cli/)
to install the CLI bundle matching the AppHost SDK before building,
to install the CLI bundle matching `sdk.version` in `aspire.config.json` before building,
with a dedicated timeout and logs rather than relying on MSBuild's automatic bundle bootstrap.
After building, setup installs Playwright Chromium and its Linux dependencies using the
AppHost test project's generated script before running the .NET suite, including browser journeys.

### Aspire agent setup

The Aspire bundle was generated with Aspire CLI 13.6.4 using `aspire agent init`, not hand-written.
The `aspire` router routes to companion skills, so keep the installed skills and their reference
files together. Refresh both repository-local copies from the repository root:

```powershell
aspire agent init --non-interactive --workspace-root . `
--skill-locations standard,claudecode `
--skills aspire,aspireify,aspire-orchestration,aspire-monitoring,aspire-deployment `
--mcp=false
```

`aspire-init` (first-run scaffolding) and `aspire-project-v2-migration` (one-time `ProjectResource`
to `DotnetProjectResource` migration) are intentionally omitted: this repository already has an
AppHost, and Project v2 is not adopted. The router still names them; reinstall with
`aspire agent init --skills <name>` only if that work is actually planned.

The explicit skill list excludes optional companion tools such as `playwright-cli` and
`dotnet-inspect`. `--mcp=false` leaves existing MCP configuration unchanged; these skills use
the Aspire CLI without requiring an MCP server. The installer also refreshes user-level
`~/.agents/skills` and installs agent usage telemetry hooks by default. Set
`ASPIRE_CLI_TELEMETRY_OPTOUT=true` to opt out of telemetry.
Keep the checked-in Aspire skills and their reference files together, including both repository
copies under `.agents/skills/` and `.claude/skills/`. Use `aspire agent init` only when intentionally
changing agent setup: its behavior is CLI-version-dependent and may change skill copies or plugin
configuration. Review its current options and the resulting diff before applying changes.

Installing guidance does not execute or approve its workflows. This repository's AppHost is
for **local development only**. Production continues through the existing Docker/CI pipeline,
Expand Down
Loading