|
3 | 3 |
|
4 | 4 | # This script packages, installs and creates a template to help with rapid iteration in the templating area. |
5 | 5 | [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 | +) |
7 | 30 |
|
8 | 31 | Set-StrictMode -Version 2 |
9 | 32 | $ErrorActionPreference = 'Stop' |
10 | 33 |
|
11 | | -. $PSScriptRoot\Test-Template.ps1 |
| 34 | +$templateArguments = @("blazorwasm"); |
12 | 35 |
|
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