-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild.ps1
53 lines (48 loc) · 1.73 KB
/
Build.ps1
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
<#
.SYNOPSIS
Build the project
.DESCRIPTION
Build the project and copy the DLL to the Module directory.
.EXAMPLE
. ./Build.ps1
Run the build script to build the project (in debug configuration) and copy the DLL to the Module directory.
.EXAMPLE
. ./Build.ps1 -Configuration Release
Run the build script to build the project (in release configuration) and copy the DLL to the Module directory.
#>
[CmdletBinding(DefaultParameterSetName = 'Build')]
param(
# The configuration of the build (`Debug` or `Release`) [Default: `Debug`]
[Parameter(ParameterSetName = 'Build')]
[ValidateSet('Debug', 'Release')]
[string] $Configuration = 'Debug',
# The target framework of the build (`net7.0` or `net8.0`) [Default: `net8.0`]
[ValidateSet("net7.0", "net8.0")]
[ValidateNotNullOrEmpty()]
[string] $TargetFramework = "net8.0"
)
# Path to the Predictor project
$Project = "$PSScriptRoot\Predictor\PSFavoritePredictor.csproj"
# Build the Predictor DLL
dotnet build $Project -c $Configuration -f $TargetFramework
# Items to copy to the Module directory
@(
@{
Source = "$PSScriptRoot\Predictor\bin\$Configuration\$TargetFramework\PSFavoritePredictor.dll"
Destination = "$PSScriptRoot\Module\Library\PSFavoritePredictor.dll"
},
@{
Source = "$PSScriptRoot\README.md"
Destination = "$PSScriptRoot\Module\README.md"
},
@{
Source = "$PSScriptRoot\LICENSE"
Destination = "$PSScriptRoot\Module\LICENSE"
}
) | ForEach-Object {
if (Test-Path -Path $_.Destination) {
Remove-Item -Path $_.Destination -Force
}
Copy-Item -Path $_.Source -Destination $_.Destination -Force
Write-Output "Copied $($_.Source) to $($_.Destination)"
}