Skip to content

Commit 1293fdb

Browse files
Web API templates updates (#49501)
- Rename new API template files/directories to match template name "WebApiAot" - Re-order options for Web API template so that "Use controllers" shows up last in VS - Adjust logic of Web API template options in VS so that persistence of "Use controllers" options works correctly across versions - Update Web API template strings for new options and changes - Added baseline test scenarios for Web API template to cover extra scenarios
1 parent dc1812a commit 1293fdb

Some content is hidden

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

47 files changed

+92
-89
lines changed

src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
<GeneratedContent Include="RazorClassLibrary-CSharp.csproj.in" OutputPath="content/RazorClassLibrary-CSharp/Company.RazorClassLibrary1.csproj" />
5858
<GeneratedContent Include="StarterWeb-CSharp.csproj.in" OutputPath="content/StarterWeb-CSharp/Company.WebApplication1.csproj" />
5959
<GeneratedContent Include="StarterWeb-FSharp.fsproj.in" OutputPath="content/StarterWeb-FSharp/Company.WebApplication1.fsproj" />
60-
<GeneratedContent Include="Api-CSharp.csproj.in" OutputPath="content/Api-CSharp/Company.ApiApplication1.csproj" />
6160
<GeneratedContent Include="WebApi-CSharp.csproj.in" OutputPath="content/WebApi-CSharp/Company.WebApplication1.csproj" />
61+
<GeneratedContent Include="WebApiAot-CSharp.csproj.in" OutputPath="content/WebApiAot-CSharp/Company.ApiApplication1.csproj" />
6262
<GeneratedContent Include="WebApi-FSharp.fsproj.in" OutputPath="content/WebApi-FSharp/Company.WebApplication1.fsproj" />
6363
<GeneratedContent Include="Worker-CSharp.csproj.in" OutputPath="content/Worker-CSharp/Company.Application1.csproj" />
6464
<GeneratedContent Include="Worker-FSharp.fsproj.in" OutputPath="content/Worker-FSharp/Company.Application1.fsproj" />

src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/localize/templatestrings.en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Microsoft",
33
"name": "ASP.NET Core gRPC Service",
4-
"description": "A project template for creating a gRPC ASP.NET Core service.",
4+
"description": "A project template for creating a gRPC service using ASP.NET Core, with optional support for publishing as native AOT.",
55
"symbols/Framework/description": "The target framework for the project.",
66
"symbols/Framework/choices/net8.0/description": "Target net8.0",
77
"_symbols/Framework/choices/net8.0/description.comment": "{Locked='net8.0'}",
@@ -16,4 +16,4 @@
1616
"symbols/NativeAot/description": "Whether to enable the project for publishing as native AOT.",
1717
"postActions/restore/description": "Restore NuGet packages required by this project.",
1818
"postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'"
19-
}
19+
}

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/dotnetcli.host.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@
44
"UseLocalDB": {
55
"longName": "use-local-db"
66
},
7-
"UseMinimalAPIs": {
8-
"longName": "use-minimal-apis",
9-
"shortName": "minimal",
10-
"isHidden": true
11-
},
12-
"UseControllers": {
13-
"longName": "use-controllers",
14-
"shortName": "controllers"
15-
},
167
"AADInstance": {
178
"longName": "aad-instance",
189
"shortName": ""
@@ -94,6 +85,15 @@
9485
"UseProgramMain": {
9586
"longName": "use-program-main",
9687
"shortName": ""
88+
},
89+
"UseMinimalAPIs": {
90+
"longName": "use-minimal-apis",
91+
"shortName": "minimal",
92+
"isHidden": true
93+
},
94+
"UseControllers": {
95+
"longName": "use-controllers",
96+
"shortName": "controllers"
9797
}
9898
},
9999
"usageExamples": [

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/en/strings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"_version.comment": "{Locked}",
44
"strings": {
55
"name": "ASP.NET Core Web API",
6-
"description": "A project template for creating an ASP.NET Core application with an example Controller for a RESTful HTTP service. This template can also be used for ASP.NET Core MVC Views and Controllers.",
6+
"description": "A project template for creating a RESTful Web API using ASP.NET Core controllers or minimal APIs, with optional support for OpenAPI and authentication.",
77
"parameter.DisableOpenAPI.name": "Enable _OpenAPI support",
88
"parameter.DisableOpenAPI.description": "Enables OpenAPI (Swagger) support",
9-
"parameter.UseMinimalAPIs.name": "Use controllers (uncheck to use minimal APIs)",
10-
"parameter.UseMinimalAPIs.description": "Whether to generate an explicit Program class and Main method instead of top-level statements."
9+
"parameter.UseMinimalAPIs.name": "Use controllers",
10+
"parameter.UseMinimalAPIs.description": "Use controllers instead of minimal APIs."
1111
}
1212
}

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/ide.host.json

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,24 @@
2020
"persistenceScope": "templateGroup"
2121
},
2222
{
23-
"id": "UseMinimalAPIs",
24-
"name": {
25-
"text": "Use controllers (uncheck to use minimal APIs)",
26-
"overrideDefaultText": true
27-
},
28-
"invertBoolean": true,
29-
"isVisible": false,
30-
"defaultValue": "true",
31-
"persistenceScope": "templateGroup"
23+
"id": "UseProgramMain",
24+
"isVisible": true,
25+
"persistenceScope": "shared",
26+
"persistenceScopeName": "Microsoft"
3227
},
3328
{
34-
"id": "UseControllers",
29+
"id": "UseMinimalAPIs",
3530
"name": {
3631
"text": "Use controllers",
3732
"overrideDefaultText": true
3833
},
34+
"description": {
35+
"text": "Use controllers instead of minimal APIs.",
36+
"overrideDefaultText": true
37+
},
38+
"invertBoolean": true,
3939
"isVisible": true,
40-
"defaultValue": "false",
4140
"persistenceScope": "templateGroup"
42-
},
43-
{
44-
"id": "UseProgramMain",
45-
"isVisible": true,
46-
"persistenceScope": "shared",
47-
"persistenceScopeName": "Microsoft"
4841
}
4942
],
5043
"disableHttpsSymbol": "NoHttps"

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/localize/templatestrings.cs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"symbols/NoHttps/description": "Určuje, jestli se má protokol HTTPS vypnout. Tato možnost platí jenom v případě, že se pro --auth nepoužívají IndividualB2C, SingleOrg ani MultiOrg.",
2525
"symbols/UseLocalDB/description": "Určuje, jestli se má použít LocalDB namísto SQLite. Tato možnost platí jenom v případě, že je zadáno --auth Individual nebo --auth IndividualB2C.",
2626
"symbols/UseMinimalAPIs/description": "Určuje, jestli se místo kontrolérů mají používat minimální rozhraní API.",
27+
"symbols/UseControllers/description": "Whether to use controllers instead of minimal APIs. This option overides the value specified by --minimal.",
2728
"symbols/Framework/description": "Cílová architektura pro projekt",
2829
"symbols/Framework/choices/net8.0/description": "Cílový net8.0",
2930
"symbols/skipRestore/description": "Pokud se tato možnost zadá, přeskočí automatické obnovení projektu při vytvoření.",

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/localize/templatestrings.de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"symbols/NoHttps/description": "Ob HTTPS deaktiviert werden soll. Diese Option gilt nur, wenn IndividualB2C, SingleOrg oder MultiOrg nicht für --auth verwendet werden.",
2525
"symbols/UseLocalDB/description": "Ob LocalDB anstelle von SQLite verwendet werden soll. Diese Option gilt nur, wenn --auth Individual oder --auth IndividualB2C angegeben ist.",
2626
"symbols/UseMinimalAPIs/description": "Ob minimale APIs anstelle von Controllern verwendet werden sollen.",
27+
"symbols/UseControllers/description": "Whether to use controllers instead of minimal APIs. This option overides the value specified by --minimal.",
2728
"symbols/Framework/description": "Das Zielframework für das Projekt.",
2829
"symbols/Framework/choices/net8.0/description": "Ziel net8.0",
2930
"symbols/skipRestore/description": "Wenn angegeben, wird die automatische Wiederherstellung des Projekts beim Erstellen übersprungen.",

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/localize/templatestrings.en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Microsoft",
33
"name": "ASP.NET Core Web API",
4-
"description": "A project template for creating an ASP.NET Core application with an example Controller for a RESTful HTTP service. This template can also be used for ASP.NET Core MVC Views and Controllers.",
4+
"description": "A project template for creating a RESTful Web API using ASP.NET Core controllers or minimal APIs, with optional support for OpenAPI and authentication.",
55
"symbols/auth/choices/None/description": "No authentication",
66
"symbols/auth/choices/IndividualB2C/description": "Individual authentication with Azure AD B2C",
77
"symbols/auth/choices/SingleOrg/description": "Organizational authentication for a single tenant",
@@ -24,6 +24,7 @@
2424
"symbols/NoHttps/description": "Whether to turn off HTTPS. This option only applies if IndividualB2C, SingleOrg, or MultiOrg aren't used for --auth.",
2525
"symbols/UseLocalDB/description": "Whether to use LocalDB instead of SQLite. This option only applies if --auth Individual or --auth IndividualB2C is specified.",
2626
"symbols/UseMinimalAPIs/description": "Whether to use minimal APIs instead of controllers.",
27+
"symbols/UseControllers/description": "Whether to use controllers instead of minimal APIs. This option overides the value specified by --minimal.",
2728
"symbols/Framework/description": "The target framework for the project.",
2829
"symbols/Framework/choices/net8.0/description": "Target net8.0",
2930
"_symbols/Framework/choices/net8.0/description.comment": "{Locked='net8.0'}",
@@ -37,4 +38,4 @@
3738
"symbols/UseProgramMain/description": "Whether to generate an explicit Program class and Main method instead of top-level statements.",
3839
"postActions/restore/description": "Restore NuGet packages required by this project.",
3940
"postActions/restore/manualInstructions/default/text": "Run 'dotnet restore'"
40-
}
41+
}

src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/.template.config/localize/templatestrings.es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"symbols/NoHttps/description": "Ya sea para desactivar HTTPS. Esta opción solo se aplica si no se utilizan IndividualB2C, SingleOrg o MultiOrg para --auth.",
2525
"symbols/UseLocalDB/description": "Indica si se va a usar LocalDB en lugar de SQLite. Esta opción solo se aplica si se especifica --auth Individual o --auth IndividualB2C.",
2626
"symbols/UseMinimalAPIs/description": "Indica si se deben usar API mínimas en lugar de controladores.",
27+
"symbols/UseControllers/description": "Whether to use controllers instead of minimal APIs. This option overides the value specified by --minimal.",
2728
"symbols/Framework/description": "Marco de destino del proyecto.",
2829
"symbols/Framework/choices/net8.0/description": "net8.0 de destino",
2930
"symbols/skipRestore/description": "Si se especifica, se omite la restauración automática del proyecto durante la creación.",

0 commit comments

Comments
 (0)