-
Notifications
You must be signed in to change notification settings - Fork 733
Add AddCSharpApp method to add C# file-based apps & projects #11502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6dbfe1d
Add support for file-based apps resources
DamianEdwards 21f01a7
Mark AddCSharpApp as experimental
DamianEdwards 474a6b3
Enhance support for file-based apps and optimize AppHost SDK
DamianEdwards b2a71fb
Add XML documentation for IsFileBasedApp property in IProjectMetadata
DamianEdwards 42caef0
Update test snapshot
DamianEdwards a0f9b38
update snapshot
DamianEdwards f046a0a
Support updating AppHost projects using SDK directly
DamianEdwards 73c9c2e
Update CPM template test
DamianEdwards 51a76b9
Refactor BuildAndRunAspireTemplateWithCentralPackageManagement to use…
DamianEdwards f9560d4
Use dotnet SDK version for file-based app compat check instead of app…
DamianEdwards 514ee28
Address feedback & try to fix test
DamianEdwards a202577
Test explicit AppHost SDK & package refs still work
DamianEdwards 3eeccf5
Remove unused class
DamianEdwards 365d121
Remove commented out properties
DamianEdwards 3f029fa
Apply suggestions from code review
DamianEdwards d56c7a8
Use ProcessUtil
DamianEdwards a3fc3d3
Fix test
DamianEdwards dd9dfb4
Update generated project metadata
DamianEdwards 8d03399
Allow file-based app host with no settings file
DamianEdwards File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <Project> | ||
|
|
||
| <Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" /> | ||
|
|
||
| <PropertyGroup> | ||
| <NoWarn>$(NoWarn);ASPIRECSHARPAPPS001</NoWarn> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <Project> | ||
|
|
||
| <ItemGroup Condition="'$(IsAspireHost)' == 'true'"> | ||
| <AspireProjectOrPackageReference Include="Aspire.Hosting.AppHost" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="..\KnownResourceNames.cs" Link="KnownResourceNames.cs" /> | ||
| </ItemGroup> | ||
|
|
||
| <Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" /> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/usr/bin/env dotnet | ||
|
|
||
| #:sdk Microsoft.NET.Sdk.Web | ||
| #:package Microsoft.AspNetCore.OpenApi | ||
| #:project ../Playground.ServiceDefaults | ||
|
|
||
| using System.Text.Json.Serialization; | ||
|
|
||
| var builder = WebApplication.CreateBuilder(args); | ||
|
|
||
| builder.AddServiceDefaults(); | ||
|
|
||
| builder.Services.ConfigureHttpJsonOptions(options => | ||
| { | ||
| options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default); | ||
| }); | ||
|
|
||
| builder.Services.AddOpenApi(); | ||
|
|
||
| var app = builder.Build(); | ||
|
|
||
| app.MapGet("/", () => new HelloResponse { Message = "Hello, World!" }) | ||
| .WithName("HelloWorld"); | ||
|
|
||
| app.MapDefaultEndpoints(); | ||
|
|
||
| app.Run(); | ||
|
|
||
| sealed class HelloResponse | ||
| { | ||
| public string Message { get; set; } = "Hello, World!"; | ||
| } | ||
|
|
||
| [JsonSerializable(typeof(HelloResponse))] | ||
| sealed partial class AppJsonSerializerContext : JsonSerializerContext | ||
| { | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/launchsettings.json", | ||
| "profiles": { | ||
| "http": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "applicationUrl": "http://localhost:5202", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| } | ||
| }, | ||
| "https": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "applicationUrl": "https://localhost:7276;http://localhost:5202", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "Logging": { | ||
| "LogLevel": { | ||
| "Default": "Information", | ||
| "Microsoft.AspNetCore": "Warning" | ||
| } | ||
| }, | ||
| "AllowedHosts": "*" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #:property IsAspireHost=true | ||
| #:property PublishAot=false | ||
|
|
||
| var builder = DistributedApplication.CreateBuilder(args); | ||
|
|
||
| builder.AddCSharpApp("api", "api.cs"); | ||
|
|
||
| #if !SKIP_DASHBOARD_REFERENCE | ||
| // This project is only added in playground projects to support development/debugging | ||
| // of the dashboard. It is not required in end developer code. Comment out this code | ||
| // or build with `/p:SkipDashboardReference=true`, to test end developer | ||
| // dashboard launch experience, Refer to Directory.Build.props for the path to | ||
| // the dashboard binary (defaults to the Aspire.Dashboard bin output in the | ||
| // artifacts dir). | ||
| builder.AddProject<Projects.Aspire_Dashboard>(KnownResourceNames.AspireDashboard); | ||
| #endif | ||
|
|
||
| builder.Build().Run(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/launchsettings.json", | ||
| "profiles": { | ||
| "https": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "applicationUrl": "https://localhost:17123;http://localhost:15234", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||
| "DOTNET_ENVIRONMENT": "Development", | ||
| "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21456", | ||
| "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22678" | ||
| } | ||
| }, | ||
| "http": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "launchBrowser": true, | ||
| "applicationUrl": "http://localhost:15234", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||
| "DOTNET_ENVIRONMENT": "Development", | ||
| "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19456", | ||
| "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20678" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "Logging": { | ||
| "LogLevel": { | ||
| "Default": "Information", | ||
| "Microsoft.AspNetCore": "Warning" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.