Skip to content

Commit 19c6942

Browse files
committed
Update blazor wasm script
1 parent a315d25 commit 19c6942

File tree

1 file changed

+70
-3
lines changed

1 file changed

+70
-3
lines changed

src/ProjectTemplates/scripts/Run-BlazorWasm-Locally.ps1

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,78 @@
33

44
# This script packages, installs and creates a template to help with rapid iteration in the templating area.
55
[CmdletBinding(PositionalBinding = $false)]
6-
param()
6+
param(
7+
[ValidateSet("net9.0", "net10.0")]
8+
[string] $Framework = "net9.0",
9+
[Parameter(Mandatory = $false)]
10+
[switch] $NoRestore,
11+
[Parameter(Mandatory = $false)]
12+
[switch] $ExcludeLaunchSettings,
13+
[Parameter(Mandatory = $false)]
14+
[switch] $Empty,
15+
[Parameter(Mandatory = $false)]
16+
[ValidateSet("None", "Individual")]
17+
[string] $Auth = "None",
18+
[Parameter(Mandatory = $false)]
19+
[switch] $NoHttps,
20+
[Parameter(Mandatory = $false)]
21+
[switch] $UseProgramMain,
22+
[Parameter(Mandatory = $false)]
23+
[string] $Authority,
24+
[Parameter(Mandatory = $false)]
25+
[string] $ClientId,
26+
[switch] $Pwa,
27+
[Parameter(ValueFromRemainingArguments = $true)]
28+
[string[]] $Args
29+
)
730

831
Set-StrictMode -Version 2
932
$ErrorActionPreference = 'Stop'
1033

11-
. $PSScriptRoot\Test-Template.ps1
34+
$templateArguments = @("blazorwasm");
1235

13-
Test-Template "blazorwasm" "blazorwasm --hosted --auth Individual" "Microsoft.DotNet.Web.ProjectTemplates.9.0.9.0.0-dev.nupkg" $true
36+
if ($ExcludeLaunchSettings) {
37+
$templateArguments += "--exclude-launch-settings"
38+
}
39+
40+
if ($Empty) {
41+
$templateArguments += "-e"
42+
}
43+
44+
if ($Auth) {
45+
$templateArguments += "--auth";
46+
$templateArguments += $Auth;
47+
}
48+
49+
$mainProjectRelativePath = $null;
50+
51+
if ($NoHttps) {
52+
$templateArguments += "--no-https"
53+
}
54+
55+
if ($Authority) {
56+
$templateArguments += "--authority"
57+
$templateArguments += $Authority
58+
}
59+
60+
if ($ClientId) {
61+
$templateArguments += "--client-id"
62+
$templateArguments += $ClientId
63+
}
64+
65+
if ($Pwa) {
66+
$templateArguments += "--pwa"
67+
}
68+
69+
if ($UseProgramMain) {
70+
$templateArguments += "--use-program-main"
71+
}
72+
73+
Import-Module -Name .\Test-Template.psm1;
74+
75+
Test-Template `
76+
-TemplateName "MyBlazorWasmApp" `
77+
-TemplateArguments $templateArguments `
78+
-MainProjectRelativePath $mainProjectRelativePath `
79+
-TargetFramework $Framework `
80+
-Verbose:$VerbosePreference;

0 commit comments

Comments
 (0)