-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprimedotnet.ps1
More file actions
80 lines (67 loc) · 2.01 KB
/
Copy pathprimedotnet.ps1
File metadata and controls
80 lines (67 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/share/powershell/pwsh
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 7.3
[string[]] $netversions = @(
'8.0',
'9.0',
'10.0'
)
[string[]] $templates = @(
'console',
'web',
'classlib',
'mstest',
'xunit',
'nunit'
)
[long] $ResultCode = 0
$netversions `
| ForEach-Object {
[string] $netversion =$_
[string] $framework ="net$netversion"
[string] $sdkVersion ="$netversion.0"
Push-Location
New-Item -Path $framework -ItemType Directory `
| Set-Location
dotnet new globaljson --force --sdk-version $sdkVersion --roll-forward latestFeature
dotnet --version
dotnet --info
$templates `
| ForEach-Object {
[string] $template = $_
[string] $project = "test$template"
Push-Location
New-Item -Path $template -ItemType Directory `
| Set-Location
dotnet new $template -n $project --framework $framework
$ResultCode+=$LASTEXITCODE
if ($template -ne 'mstest' -or ($netversion -ne '9.0' -and $netversion -ne '10.0'))
{
if ($netversion -ne '10.0')
{
dotnet outdated -u $project
$ResultCode+=$LASTEXITCODE
switch($template)
{
'console' {
}
'web' {
}
'classlib' {
}
Default {
dotnet add $project package "Verify.$template"
$ResultCode+=$LASTEXITCODE
}
}
}
}
dotnet build $project
$ResultCode+=$LASTEXITCODE
Pop-Location
Remove-Item -Recurse -Force $template
}
Pop-Location
Remove-Item -Recurse -Force $framework
}
exit $ResultCode