Skip to content

Commit d39ed09

Browse files
authored
Auto-generate random port and proper project settings for the server project (#18842)
1 parent f5f51f5 commit d39ed09

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/.template.config/template.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,46 @@
107107
"datatype": "bool",
108108
"defaultValue": "false",
109109
"description": "If specified, includes an ASP.NET Core host for the Blazor app."
110+
},
111+
"HttpPort": {
112+
"type": "parameter",
113+
"datatype": "integer",
114+
"description": "Port number to use for the HTTP endpoint in launchSettings.json."
115+
},
116+
"HttpPortGenerated": {
117+
"type": "generated",
118+
"generator": "port"
119+
},
120+
"HttpPortReplacer": {
121+
"type": "generated",
122+
"generator": "coalesce",
123+
"parameters": {
124+
"sourceVariableName": "HttpPort",
125+
"fallbackVariableName": "HttpPortGenerated"
126+
},
127+
"replaces": "8080"
128+
},
129+
"HttpsPort": {
130+
"type": "parameter",
131+
"datatype": "integer",
132+
"description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)."
133+
},
134+
"HttpsPortGenerated": {
135+
"type": "generated",
136+
"generator": "port",
137+
"parameters": {
138+
"low": 44300,
139+
"high": 44399
140+
}
141+
},
142+
"HttpsPortReplacer": {
143+
"type": "generated",
144+
"generator": "coalesce",
145+
"parameters": {
146+
"sourceVariableName": "HttpsPort",
147+
"fallbackVariableName": "HttpsPortGenerated"
148+
},
149+
"replaces": "44300"
110150
}
111151
},
112152
"tags": {

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/Server/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"ASPNETCORE_ENVIRONMENT": "Development"
2121
}
2222
},
23-
"Company.WebApplication1": {
23+
"BlazorWasm-CSharp.Server": {
2424
"commandName": "Project",
2525
"launchBrowser": true,
2626
//#if(RequiresHttps)

0 commit comments

Comments
 (0)