Skip to content

Commit 1034a87

Browse files
committed
Starter web
1 parent 0ee678e commit 1034a87

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed
Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,57 @@
11
#!/usr/bin/env pwsh
22
#requires -version 4
33

4+
# This script packages, installs and creates a template to help with rapid iteration in the templating area.
45
[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+
)
624

725
Set-StrictMode -Version 2
826
$ErrorActionPreference = 'Stop'
927

10-
. $PSScriptRoot\Test-Template.ps1
28+
$templateArguments = @("mvc");
1129

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;

src/ProjectTemplates/scripts/Test-Template.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function Test-Template {
9595
Push-Location $MainProjectRelativePath;
9696
}
9797

98-
if ($TemplateArguments -match '-au') {
98+
if ('--auth' -in $TemplateArguments -and 'Individual' -in $TemplateArguments) {
9999
Write-Verbose "Running dotnet ef migrations"
100100
dotnet.exe ef migrations add Initial;
101101
}

0 commit comments

Comments
 (0)