-
Notifications
You must be signed in to change notification settings - Fork 415
Expand file tree
/
Copy pathbuild.ps1
More file actions
46 lines (38 loc) · 1.17 KB
/
Copy pathbuild.ps1
File metadata and controls
46 lines (38 loc) · 1.17 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
param(
[Parameter()]
[ValidateSet('Release', 'Debug')]
[string]
$Configuration = 'Debug',
[Parameter()]
[ValidateSet('netcoreapp3.1', 'net452')]
[string[]]
$TargetFramework = $(if ($IsWindows -eq $false) { 'netcoreapp3.1' } else { 'netcoreapp3.1', 'net452' })
)
$ErrorActionPreference = 'Stop'
$moduleName = "PSScriptAnalyzer"
$outLocation = "$PSScriptRoot/out"
$moduleOutPath = "$outLocation/$moduleName"
if (Test-Path $moduleOutPath)
{
Remove-Item -Recurse -Force $moduleOutPath
}
Push-Location $PSScriptRoot
try
{
foreach ($framework in $TargetFramework)
{
dotnet publish -f $framework
if ($LASTEXITCODE -ne 0)
{
throw 'Dotnet publish failed'
}
New-Item -ItemType Directory -Path "$moduleOutPath/$framework"
Copy-Item -Path "$PSScriptRoot/bin/$Configuration/$framework/publish/*.dll" -Destination "$moduleOutPath/$framework"
Copy-Item -Path "$PSScriptRoot/bin/$Configuration/$framework/publish/*.pdb" -Destination "$moduleOutPath/$framework" -ErrorAction Ignore
}
}
finally
{
Pop-Location
}
Copy-Item -Path "$PSScriptRoot/$moduleName.psd1" -Destination $moduleOutPath