-
Notifications
You must be signed in to change notification settings - Fork 2
/
NugetPack.ps1
27 lines (21 loc) · 1000 Bytes
/
NugetPack.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
$nugetPath = ".\NuGet.exe"
if (-not (Test-Path $nugetPath)) {
Write-Output "NuGet executable not found. Downloading..."
Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $nugetPath
}
$date = Get-Date -format "yyyy.M.d"
$time = Get-Date -format "HHmmss"
$versionString = $date + "-dev" + $time
Write-Output "Version: $versionString"
Get-ChildItem -Include *.nuspec, *.props -Recurse | ForEach-Object {
(Get-Content $_.FullName) -replace '{{NuGetVersion}}', $versionString |
Set-Content $_.FullName
}
.\NuGet.exe pack Neolution.CodeAnalysis.nuspec -OutputDirectory .\bin\packages
.\NuGet.exe pack Neolution.CodeAnalysis.TestsRuleset.nuspec -OutputDirectory .\bin\packages
Get-ChildItem -Include *.nuspec, *.props -Recurse | ForEach-Object {
(Get-Content $_.FullName) -replace $versionString, '{{NuGetVersion}}' |
Set-Content $_.FullName
}
# Wait for user input before closing the window
Read-Host -Prompt "Press Enter to exit"