Skip to content

Commit 143d72d

Browse files
Remove IIS launch profiles from templates (#56489)
* Remove IIS launch profiles from templates VS now supports showing the IIS Express launch option all the time and will auto-create the launch profile if one doesn't already exist. Fixes #46501 Fixes #42818 * Update tests * Update MvcTemplateTest.cs * Fix templates * Fix trailing comma
1 parent d22349a commit 143d72d

File tree

16 files changed

+67
-257
lines changed

16 files changed

+67
-257
lines changed

src/ProjectTemplates/Shared/BlazorTemplateTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ protected async Task<Project> CreateBuildPublishAsync(string auth = null, string
6262
|| (!serverProject && auth is not null);
6363
var noHttps = args?.Contains(ArgConstants.NoHttps) ?? false;
6464
var expectedLaunchProfileNames = requiresHttps
65-
? new[] { "https", "IIS Express" }
65+
? new[] { "https" }
6666
: noHttps
67-
? new[] { "http", "IIS Express" }
68-
: new[] { "http", "https", "IIS Express" };
67+
? new[] { "http" }
68+
: new[] { "http", "https" };
6969
await project.VerifyLaunchSettings(expectedLaunchProfileNames);
7070
}
7171

src/ProjectTemplates/Shared/Project.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -329,20 +329,6 @@ public async Task VerifyLaunchSettings(string[] expectedLaunchProfileNames)
329329

330330
// Check there are no more launch profiles defined
331331
Assert.False(profilesEnumerator.MoveNext());
332-
333-
if (launchSettings.RootElement.TryGetProperty("iisSettings", out var iisSettings)
334-
&& iisSettings.TryGetProperty("iisExpress", out var iisExpressSettings))
335-
{
336-
var iisSslPort = iisExpressSettings.GetProperty("sslPort").GetInt32();
337-
if (expectedLaunchProfileNames.Contains("https"))
338-
{
339-
Assert.True(iisSslPort >= 44300 && iisSslPort <= 44399, $"IIS Express port was expected to be >= 44300 and <= 44399 but was {iisSslPort} in file {filePath}");
340-
}
341-
else
342-
{
343-
Assert.Equal(0, iisSslPort);
344-
}
345-
}
346332
}
347333
}
348334

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
{
22
"$schema": "https://json.schemastore.org/launchsettings.json",
3-
"iisSettings": {
4-
"windowsAuthentication": false,
5-
"anonymousAuthentication": true,
6-
"iisExpress": {
7-
"applicationUrl": "http://localhost:8080",
8-
//#if (HasHttpsProfile)
9-
"sslPort": 44300
10-
//#else
11-
"sslPort": 0
12-
//#endif
13-
}
14-
},
153
"profiles": {
164
//#if (HasHttpProfile)
175
"http": {
@@ -25,7 +13,11 @@
2513
"environmentVariables": {
2614
"ASPNETCORE_ENVIRONMENT": "Development"
2715
}
16+
//#if (HasHttpsProfile)
2817
},
18+
//#else
19+
}
20+
//#endif
2921
//#endif
3022
//#if (HasHttpsProfile)
3123
"https": {
@@ -39,17 +31,7 @@
3931
"environmentVariables": {
4032
"ASPNETCORE_ENVIRONMENT": "Development"
4133
}
42-
},
43-
//#endif
44-
"IIS Express": {
45-
"commandName": "IISExpress",
46-
"launchBrowser": true,
47-
//#if (UseWebAssembly)
48-
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
49-
//#endif
50-
"environmentVariables": {
51-
"ASPNETCORE_ENVIRONMENT": "Development"
52-
}
5334
}
35+
//#endif
5436
}
5537
}
Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
{
22
"$schema": "https://json.schemastore.org/launchsettings.json",
3-
"iisSettings": {
4-
//#if (WindowsAuth)
5-
"windowsAuthentication": true,
6-
"anonymousAuthentication": false,
7-
//#else
8-
"windowsAuthentication": false,
9-
"anonymousAuthentication": true,
10-
//#endif
11-
"iisExpress": {
12-
"applicationUrl": "http://localhost:8080",
13-
//#if (HasHttpsProfile)
14-
"sslPort": 44300
15-
//#else
16-
"sslPort": 0
17-
//#endif
18-
}
19-
},
203
"profiles": {
214
//#if (HasHttpProfile)
225
"http": {
@@ -28,7 +11,11 @@
2811
"environmentVariables": {
2912
"ASPNETCORE_ENVIRONMENT": "Development"
3013
}
14+
//#if (HasHttpsProfile)
3115
},
16+
//#else
17+
}
18+
//#endif
3219
//#endif
3320
//#if (HasHttpsProfile)
3421
"https": {
@@ -40,15 +27,7 @@
4027
"environmentVariables": {
4128
"ASPNETCORE_ENVIRONMENT": "Development"
4229
}
43-
},
44-
//#endif
45-
"IIS Express": {
46-
"commandName": "IISExpress",
47-
"launchBrowser": true,
48-
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
49-
"environmentVariables": {
50-
"ASPNETCORE_ENVIRONMENT": "Development"
51-
}
5230
}
31+
//#endif
5332
}
5433
}
Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
{
22
"$schema": "https://json.schemastore.org/launchsettings.json",
3-
"iisSettings": {
4-
//#if (WindowsAuth)
5-
"windowsAuthentication": true,
6-
"anonymousAuthentication": false,
7-
//#else
8-
"windowsAuthentication": false,
9-
"anonymousAuthentication": true,
10-
//#endif
11-
"iisExpress": {
12-
"applicationUrl": "http://localhost:8080",
13-
//#if (HasHttpsProfile)
14-
"sslPort": 44300
15-
//#else
16-
"sslPort": 0
17-
//#endif
18-
}
19-
},
203
"profiles": {
214
"http": {
225
"commandName": "Project",
@@ -26,7 +9,11 @@
269
"environmentVariables": {
2710
"ASPNETCORE_ENVIRONMENT": "Development"
2811
}
12+
//#if (HasHttpsProfile)
2913
},
14+
//#else
15+
}
16+
//#endif
3017
//#if (HasHttpsProfile)
3118
"https": {
3219
"commandName": "Project",
@@ -36,14 +23,7 @@
3623
"environmentVariables": {
3724
"ASPNETCORE_ENVIRONMENT": "Development"
3825
}
39-
},
40-
//#endif
41-
"IIS Express": {
42-
"commandName": "IISExpress",
43-
"launchBrowser": true,
44-
"environmentVariables": {
45-
"ASPNETCORE_ENVIRONMENT": "Development"
46-
}
4726
}
27+
//#endif
4828
}
4929
}
Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
{
22
"$schema": "https://json.schemastore.org/launchsettings.json",
3-
"iisSettings": {
4-
"windowsAuthentication": false,
5-
"anonymousAuthentication": true,
6-
"iisExpress": {
7-
"applicationUrl": "http://localhost:8080",
8-
//#if (HasHttpsProfile)
9-
"sslPort": 44300
10-
//#else
11-
"sslPort": 0
12-
//#endif
13-
}
14-
},
153
"profiles": {
164
"http": {
175
"commandName": "Project",
@@ -21,7 +9,11 @@
219
"environmentVariables": {
2210
"ASPNETCORE_ENVIRONMENT": "Development"
2311
}
12+
//#if (HasHttpsProfile)
2413
},
14+
//#else
15+
}
16+
//#endif
2517
//#if (HasHttpsProfile)
2618
"https": {
2719
"commandName": "Project",
@@ -31,14 +23,7 @@
3123
"environmentVariables": {
3224
"ASPNETCORE_ENVIRONMENT": "Development"
3325
}
34-
},
35-
//#endif
36-
"IIS Express": {
37-
"commandName": "IISExpress",
38-
"launchBrowser": true,
39-
"environmentVariables": {
40-
"ASPNETCORE_ENVIRONMENT": "Development"
41-
}
4226
}
27+
//#endif
4328
}
4429
}
Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
{
22
"$schema": "https://json.schemastore.org/launchsettings.json",
3-
"iisSettings": {
4-
//#if (WindowsAuth)
5-
"windowsAuthentication": true,
6-
"anonymousAuthentication": false,
7-
//#else
8-
"windowsAuthentication": false,
9-
"anonymousAuthentication": true,
10-
//#endif
11-
"iisExpress": {
12-
"applicationUrl": "http://localhost:8080",
13-
//#if (HasHttpsProfile)
14-
"sslPort": 44300
15-
//#else
16-
"sslPort": 0
17-
//#endif
18-
}
19-
},
203
"profiles": {
214
//#if (HasHttpProfile)
225
"http": {
@@ -27,7 +10,11 @@
2710
"environmentVariables": {
2811
"ASPNETCORE_ENVIRONMENT": "Development"
2912
}
13+
//#if (HasHttpsProfile)
3014
},
15+
//#else
16+
}
17+
//#endif
3118
//#endif
3219
//#if (HasHttpsProfile)
3320
"https": {
@@ -38,14 +25,7 @@
3825
"environmentVariables": {
3926
"ASPNETCORE_ENVIRONMENT": "Development"
4027
}
41-
},
42-
//#endif
43-
"IIS Express": {
44-
"commandName": "IISExpress",
45-
"launchBrowser": true,
46-
"environmentVariables": {
47-
"ASPNETCORE_ENVIRONMENT": "Development"
48-
}
4928
}
29+
//#endif
5030
}
5131
}
Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
{
22
"$schema": "https://json.schemastore.org/launchsettings.json",
3-
"iisSettings": {
4-
//#if (WindowsAuth)
5-
"windowsAuthentication": true,
6-
"anonymousAuthentication": false,
7-
//#else
8-
"windowsAuthentication": false,
9-
"anonymousAuthentication": true,
10-
//#endif
11-
"iisExpress": {
12-
"applicationUrl": "http://localhost:8080",
13-
//#if (HasHttpsProfile)
14-
"sslPort": 44300
15-
//#else
16-
"sslPort": 0
17-
//#endif
18-
}
19-
},
203
"profiles": {
214
//#if (HasHttpProfile)
225
"http": {
@@ -27,7 +10,11 @@
2710
"environmentVariables": {
2811
"ASPNETCORE_ENVIRONMENT": "Development"
2912
}
13+
//#if (HasHttpsProfile)
3014
},
15+
//#else
16+
}
17+
//#endif
3118
//#endif
3219
//#if (HasHttpsProfile)
3320
"https": {
@@ -38,14 +25,7 @@
3825
"environmentVariables": {
3926
"ASPNETCORE_ENVIRONMENT": "Development"
4027
}
41-
},
42-
//#endif
43-
"IIS Express": {
44-
"commandName": "IISExpress",
45-
"launchBrowser": true,
46-
"environmentVariables": {
47-
"ASPNETCORE_ENVIRONMENT": "Development"
48-
}
4928
}
29+
//#endif
5030
}
5131
}
Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
{
22
"$schema": "https://json.schemastore.org/launchsettings.json",
3-
"iisSettings": {
4-
//#if (WindowsAuth)
5-
"windowsAuthentication": true,
6-
"anonymousAuthentication": false,
7-
//#else
8-
"windowsAuthentication": false,
9-
"anonymousAuthentication": true,
10-
//#endif
11-
"iisExpress": {
12-
"applicationUrl": "http://localhost:8080",
13-
//#if (HasHttpsProfile)
14-
"sslPort": 44300
15-
//#else
16-
"sslPort": 0
17-
//#endif
18-
}
19-
},
203
"profiles": {
214
"http": {
225
"commandName": "Project",
@@ -26,7 +9,11 @@
269
"environmentVariables": {
2710
"ASPNETCORE_ENVIRONMENT": "Development"
2811
}
12+
//#if (HasHttpsProfile)
2913
},
14+
//#else
15+
}
16+
//#endif
3017
//#if (HasHttpsProfile)
3118
"https": {
3219
"commandName": "Project",
@@ -36,14 +23,7 @@
3623
"environmentVariables": {
3724
"ASPNETCORE_ENVIRONMENT": "Development"
3825
}
39-
},
40-
//#endif
41-
"IIS Express": {
42-
"commandName": "IISExpress",
43-
"launchBrowser": true,
44-
"environmentVariables": {
45-
"ASPNETCORE_ENVIRONMENT": "Development"
46-
}
4726
}
27+
//#endif
4828
}
4929
}

0 commit comments

Comments
 (0)