Skip to content

Commit e1c4295

Browse files
authored
Unhide server option in blazor web template (#48838)
* unhide blazor --use-server option
1 parent 0b632fa commit e1c4295

File tree

4 files changed

+28
-17
lines changed

4 files changed

+28
-17
lines changed

src/ProjectTemplates/Shared/ArgConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ internal static class ArgConstants
2626
public const string UseLocalDb = "-uld";
2727
public const string NoHttps = "--no-https";
2828
public const string PublishNativeAot = "--aot";
29+
public const string UseServer = "--use-server";
2930
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
"isHidden": true
1111
},
1212
"UseServer": {
13-
"longName": "use-server",
14-
"isHidden": true
13+
"longName": "use-server"
1514
},
1615
"UseWebAssembly": {
1716
"longName": "use-wasm",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"symbolInfo": [
77
{
88
"id": "UseServer",
9-
"isVisible": false,
9+
"isVisible": true,
1010
"persistenceScope": "templateGroup"
1111
},
1212
{

src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorWebTemplateTest.cs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,14 @@ public ITestOutputHelper Output
3030

3131
[ConditionalTheory]
3232
[SkipOnHelix("Cert failure, https://github.com/dotnet/aspnetcore/issues/28090", Queues = "All.OSX;" + HelixConstants.Windows10Arm64 + HelixConstants.DebianArm64)]
33-
[InlineData(true, false)]
34-
[InlineData(true, true)]
35-
[InlineData(false, false)]
36-
[InlineData(false, true)]
37-
public async Task BlazorWebTemplate_NoAuth(bool useProgramMain, bool noHttps)
33+
[MemberData(nameof(ArgsData))]
34+
public async Task BlazorWebTemplate_NoAuth(string[] args)
3835
{
3936
var project = await ProjectFactory.CreateProject(Output);
4037

41-
var args = useProgramMain
42-
? noHttps
43-
? new[] { ArgConstants.UseProgramMain, ArgConstants.NoHttps }
44-
: new[] { ArgConstants.UseProgramMain }
45-
: noHttps
46-
? new[] { ArgConstants.NoHttps }
47-
: null;
4838
await project.RunDotNetNewAsync("blazor", args: args);
4939

50-
var expectedLaunchProfileNames = noHttps
40+
var expectedLaunchProfileNames = args.Contains(ArgConstants.NoHttps)
5141
? new[] { "http", "IIS Express" }
5242
: new[] { "http", "https", "IIS Express" };
5343
await project.VerifyLaunchSettings(expectedLaunchProfileNames);
@@ -79,6 +69,14 @@ public async Task BlazorWebTemplate_NoAuth(bool useProgramMain, bool noHttps)
7969
}
8070
};
8171

72+
if (args.Contains(ArgConstants.UseServer))
73+
{
74+
pages.Add(new Page
75+
{
76+
Url = BlazorTemplatePages.Counter,
77+
});
78+
}
79+
8280
using (var aspNetProcess = project.StartBuiltProjectAsync())
8381
{
8482
Assert.False(
@@ -98,6 +96,18 @@ public async Task BlazorWebTemplate_NoAuth(bool useProgramMain, bool noHttps)
9896
}
9997
}
10098

99+
public static TheoryData<string[]> ArgsData() => new TheoryData<string[]>
100+
{
101+
new string[0],
102+
new[] { ArgConstants.UseProgramMain },
103+
new[] { ArgConstants.NoHttps },
104+
new[] { ArgConstants.UseProgramMain, ArgConstants.NoHttps },
105+
new[] { ArgConstants.UseServer },
106+
new[] { ArgConstants.UseServer, ArgConstants.UseProgramMain },
107+
new[] { ArgConstants.UseServer, ArgConstants.NoHttps },
108+
new[] { ArgConstants.UseServer, ArgConstants.UseProgramMain, ArgConstants.NoHttps }
109+
};
110+
101111
private string ReadFile(string basePath, string path)
102112
{
103113
var fullPath = Path.Combine(basePath, path);
@@ -111,5 +121,6 @@ private class BlazorTemplatePages
111121
{
112122
internal static readonly string Index = "";
113123
internal static readonly string FetchData = "showdata";
114-
}
124+
internal static readonly string Counter = "counter";
125+
}
115126
}

0 commit comments

Comments
 (0)