-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBuildNuGets.ps1
35 lines (29 loc) · 1.11 KB
/
BuildNuGets.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
#!/usr/bin/env pwsh
# Stop on first error
$ErrorActionPreference = "Stop"
# Store current location and move to script directory
Push-Location
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $scriptDir
try {
Write-Host "Building Solution..."
dotnet restore
dotnet build --configuration Release --no-restore
Write-Host "Creating NuGet Package..."
# Create the Packages directory if it doesn't exist
$packagesDir = "Source/TimeWarp.SourceGenerators/bin/Packages"
New-Item -ItemType Directory -Force -Path $packagesDir | Out-Null
# Pack the project and output to the Packages directory
# NoWarn=NU5128 is added to suppress the warning about lib folder matching
dotnet pack Source/TimeWarp.SourceGenerators/TimeWarp.SourceGenerators.csproj `
--configuration Release `
--no-build `
--output $packagesDir `
-p:NoWarn=NU5128
Write-Host "Build and Pack completed successfully"
Write-Host "Packages have been placed in $packagesDir"
}
finally {
# Return to original location
Pop-Location
}