Skip to content

Commit e138b34

Browse files
Copilotkamilbaczek
andcommitted
Add Aspire AppHost project to Chapter 2
Co-authored-by: kamilbaczek <74410956+kamilbaczek@users.noreply.github.com>
1 parent 691dc9a commit e138b34

6 files changed

Lines changed: 70 additions & 0 deletions

File tree

Chapter-2-modules-separation/Src/Directory.Packages.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
</PropertyGroup>
55
<ItemGroup Label="Production">
6+
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.0.0" />
7+
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="9.0.0" />
68
<PackageVersion Include="Dapper" Version="2.1.66" />
79
<PackageVersion Include="FluentValidation" Version="12.0.0" />
810
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="12.0.0" />
911
<PackageVersion Include="JetBrains.Annotations" Version="2025.2.2" />
12+
<PackageVersion Include="KubernetesClient" Version="17.0.14" />
1013
<PackageVersion Include="MediatR" Version="12.5.0" />
1114
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
1215
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="9.0.9" />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0"/>
3+
4+
<PropertyGroup>
5+
<OutputType>Exe</OutputType>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<IsAspireHost>true</IsAspireHost>
9+
<UserSecretsId>a3ef42d8-8e72-4dd1-a8a7-cd43e2c575e8</UserSecretsId>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Aspire.Hosting.AppHost" />
14+
<PackageReference Include="Aspire.Hosting.PostgreSQL" />
15+
<PackageReference Include="KubernetesClient" />
16+
<PackageReference Update="SonarAnalyzer.CSharp" Version="10.15.0.120848" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<ProjectReference Include="..\Fitnet\Fitnet.csproj"/>
21+
</ItemGroup>
22+
23+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Projects;
2+
3+
var builder = DistributedApplication.CreateBuilder(args);
4+
var postgres = builder.AddPostgres("postgres")
5+
.WithImage("postgres", "14.3")
6+
.WithPgAdmin();
7+
8+
var fitnetDatabase = postgres.AddDatabase("fitnetsdb", "fitnet");
9+
builder.AddProject<Fitnet>("fitnet")
10+
.WithEnvironment("ASPNETCORE_ENVIRONMENT", "Development")
11+
.WithReference(fitnetDatabase, "Passes__ConnectionStrings")
12+
.WithReference(fitnetDatabase, "Contracts__ConnectionStrings")
13+
.WithReference(fitnetDatabase, "Reports__ConnectionStrings")
14+
.WithReference(fitnetDatabase, "Offers__ConnectionStrings")
15+
.WaitFor(postgres);
16+
17+
await builder.Build().RunAsync();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"https": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": true,
7+
"launchBrowser": true,
8+
"applicationUrl": "https://localhost:17106;http://localhost:15108",
9+
"environmentVariables": {
10+
"ASPNETCORE_ENVIRONMENT": "Development",
11+
"DOTNET_ENVIRONMENT": "Development",
12+
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21130",
13+
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22190"
14+
}
15+
}
16+
}
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning",
6+
"Aspire.Hosting.Dcp": "Warning"
7+
}
8+
}
9+
}

Chapter-2-modules-separation/Src/Fitnet.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@
4242
<Folder Name="/Reports/Tests/">
4343
<Project Path="Reports\Tests\Fitnet.Reports.IntegrationTests\Fitnet.Reports.IntegrationTests.csproj" Type="Classic C#" />
4444
</Folder>
45+
<Project Path="Fitnet.AppHost/Fitnet.AppHost.csproj" />
4546
<Project Path="Fitnet\Fitnet.csproj" Type="Classic C#" />
4647
</Solution>

0 commit comments

Comments
 (0)