|
1 | 1 | #!/usr/bin/env pwsh |
2 | 2 | #requires -version 4 |
3 | 3 |
|
| 4 | +# This script packages, installs and creates a template to help with rapid iteration in the templating area. |
4 | 5 | [CmdletBinding(PositionalBinding = $false)] |
5 | | -param() |
| 6 | +param( |
| 7 | + [Parameter(Mandatory = $false, Position = 0)] |
| 8 | + [ValidateSet("net9.0", "net10.0")] |
| 9 | + [string] $Framework = "net9.0", |
| 10 | + [Parameter(Mandatory = $false)] |
| 11 | + [switch] $ExcludeLaunchSettings, |
| 12 | + [Parameter(Mandatory = $false)] |
| 13 | + [ValidateSet("None", "Individual")] |
| 14 | + [string] $Auth = "None", |
| 15 | + [Parameter(Mandatory = $false)] |
| 16 | + [switch] $UseLocalDb, |
| 17 | + [Parameter(Mandatory = $false)] |
| 18 | + [switch] $NoHttps, |
| 19 | + [Parameter(Mandatory = $false)] |
| 20 | + [switch] $UseProgramMain, |
| 21 | + [Parameter(ValueFromRemainingArguments = $true)] |
| 22 | + [string[]] $Args |
| 23 | +) |
6 | 24 |
|
7 | 25 | Set-StrictMode -Version 2 |
8 | 26 | $ErrorActionPreference = 'Stop' |
9 | 27 |
|
10 | | -. $PSScriptRoot\Test-Template.ps1 |
| 28 | +$templateArguments = @("mvc"); |
11 | 29 |
|
12 | | -Test-Template "mvc" "mvc -au Individual" "Microsoft.DotNet.Web.ProjectTemplates.9.0.9.0.0-dev.nupkg" $false |
| 30 | +if ($ExcludeLaunchSettings) { |
| 31 | + $templateArguments += "--exclude-launch-settings" |
| 32 | +} |
| 33 | + |
| 34 | +if ($Auth) { |
| 35 | + $templateArguments += "--auth"; |
| 36 | + $templateArguments += $Auth; |
| 37 | +} |
| 38 | + |
| 39 | +if ($UseLocalDb) { |
| 40 | + $templateArguments += "-uld" |
| 41 | +} |
| 42 | + |
| 43 | +if ($NoHttps) { |
| 44 | + $templateArguments += "--no-https" |
| 45 | +} |
| 46 | + |
| 47 | +if ($UseProgramMain) { |
| 48 | + $templateArguments += "--use-program-main" |
| 49 | +} |
| 50 | + |
| 51 | +Import-Module -Name .\Test-Template.psm1; |
| 52 | + |
| 53 | +Test-Template ` |
| 54 | + -TemplateName "MyMvcApp" ` |
| 55 | + -TemplateArguments $templateArguments ` |
| 56 | + -TargetFramework $Framework ` |
| 57 | + -Verbose:$VerbosePreference; |
0 commit comments