Skip to content

Commit f9f44e1

Browse files
authored
Convert samples to use Aspire (#593)
This updates the samples to use Aspire for connecting the client ASP.NET Core and the server ASP.NET Framework applications. This does the following: - Separate out Directory.Packages.props for samples/src/test. The src one pins all the dependencies so that we know which versions are being used, while the test/samples do not so they can run in a more hybrid setup - Update the folder structure to keep samples together - Update playwright tests to connect via Aspire - Ensure each sample has a smoke test (either via HttpClient or Playwright) - Use libman for managing sample javascript/css files
1 parent da2c5f4 commit f9f44e1

File tree

492 files changed

+1910
-2634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

492 files changed

+1910
-2634
lines changed

Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,8 @@
4646
Suppress warning for internal experimental APIs
4747
-->
4848
<NoWarn>$(NoWarn);SYSWEB1001</NoWarn>
49+
50+
<!-- We want to run pack on the solution so this allows us to do that -->
51+
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
4952
</PropertyGroup>
5053
</Project>

Microsoft.AspNetCore.SystemWebAdapters.sln

Lines changed: 140 additions & 137 deletions
Large diffs are not rendered by default.

Microsoft.AspNetCore.SystemWebAdapters.slnf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
"test\\Microsoft.AspNetCore.SystemWebAdapters.CoreServices.Tests\\Microsoft.AspNetCore.SystemWebAdapters.CoreServices.Tests.csproj",
1111
"test\\Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests\\Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests.csproj",
1212
"test\\Microsoft.AspNetCore.SystemWebAdapters.NuGet.Tests\\Microsoft.AspNetCore.SystemWebAdapters.NuGet.Tests.csproj",
13-
"test\\Microsoft.AspNetCore.SystemWebAdapters.Tests\\Microsoft.AspNetCore.SystemWebAdapters.Tests.csproj",
14-
"test\\Samples.MVCApp.Tests\\Samples.MVCApp.Tests.csproj",
15-
"test\\Samples.RemoteAuth.Forms.Tests\\Samples.RemoteAuth.Forms.Tests.csproj"
13+
"test\\Microsoft.AspNetCore.SystemWebAdapters.Tests\\Microsoft.AspNetCore.SystemWebAdapters.Tests.csproj"
1614
]
1715
}
18-
}
16+
}

global.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@
66
"dotnet": "10.0.100-preview.5.25265.106",
77
"runtimes": {
88
"dotnet": [
9-
"6.0.4",
10-
"7.0.12",
11-
"8.0.1"
9+
"8.0.16",
10+
"9.0.5"
1211
],
1312
"aspnetcore": [
14-
"6.0.4",
15-
"7.0.12",
16-
"8.0.1"
13+
"8.0.16",
14+
"9.0.5"
1715
]
1816
}
1917
},
2018
"msbuild-sdks": {
21-
"MSBuild.SDK.SystemWeb": "4.0.88",
19+
"MSBuild.SDK.SystemWeb": "4.0.104",
20+
"Aspire.AppHost.Sdk": "9.3.0",
2221
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25279.3"
2322
}
2423
}
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+
3+
<Sdk Name="Aspire.AppHost.Sdk" />
4+
5+
<PropertyGroup>
6+
<OutputType>Exe</OutputType>
7+
<TargetFramework>net9.0-windows</TargetFramework>
8+
<ImplicitUsings>enable</ImplicitUsings>
9+
<Nullable>enable</Nullable>
10+
<IsAspireHost>true</IsAspireHost>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Aspire.Hosting.AppHost" />
15+
<PackageReference Include="C3D.Extensions.Aspire.IISExpress" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<ProjectReference Include="..\AuthRemoteFormsAuthCore\AuthRemoteFormsAuthCore.csproj" />
20+
<ProjectReference Include="..\AuthRemoteFormsAuthFramework\AuthRemoteFormsAuthFramework.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+
var builder = DistributedApplication.CreateBuilder(args);
2+
3+
var remoteApiKey = builder.AddParameter("apiKey", Guid.NewGuid().ToString(), secret: true);
4+
5+
var frameworkApp = builder.AddIISExpress("iis")
6+
.AddSiteProject<Projects.AuthRemoteFormsAuthFramework>("framework")
7+
.WithDefaultIISExpressEndpoints()
8+
.WithEnvironment("RemoteApp__ApiKey", remoteApiKey)
9+
.WithHttpHealthCheck();
10+
11+
var coreApp = builder.AddProject<Projects.AuthRemoteFormsAuthCore>("core")
12+
.WithEnvironment("RemoteApp__ApiKey", remoteApiKey)
13+
.WithEnvironment("RemoteApp__Url", frameworkApp.GetEndpoint("https"))
14+
.WithHttpHealthCheck()
15+
.WaitFor(frameworkApp);
16+
17+
builder.Build().Run();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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:17095;http://localhost:15283",
9+
"environmentVariables": {
10+
"ASPNETCORE_ENVIRONMENT": "Development",
11+
"DOTNET_ENVIRONMENT": "Development",
12+
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21002",
13+
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22119"
14+
}
15+
},
16+
"http": {
17+
"commandName": "Project",
18+
"dotnetRunMessages": true,
19+
"launchBrowser": true,
20+
"applicationUrl": "http://localhost:15283",
21+
"environmentVariables": {
22+
"ASPNETCORE_ENVIRONMENT": "Development",
23+
"DOTNET_ENVIRONMENT": "Development",
24+
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19075",
25+
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20035"
26+
}
27+
}
28+
}
29+
}
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+
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
3+
<TargetFramework>net9.0</TargetFramework>
44
<Nullable>enable</Nullable>
55
<ImplicitUsings>enable</ImplicitUsings>
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageReference Include="Yarp.ReverseProxy" />
99
</ItemGroup>
1010
<ItemGroup>
11-
<ProjectReference Include="..\..\..\..\src\Microsoft.AspNetCore.SystemWebAdapters.CoreServices\Microsoft.AspNetCore.SystemWebAdapters.CoreServices.csproj" />
11+
<ProjectReference Include="..\..\ServiceDefaults\Samples.ServiceDefaults.Core\Samples.ServiceDefaults.Core.csproj" />
1212
</ItemGroup>
1313
</Project>

0 commit comments

Comments
 (0)