-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
39 lines (33 loc) · 955 Bytes
/
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
function ExitIfFailed()
{
if ($LASTEXITCODE -ne 0)
{
Write-Host "An error occurred. Stopping build." -foregroundcolor "red"
Pause
exit
}
}
function CopyNupkg($projectFolder)
{
$releaseFolder = $projectFolder + "/bin/Release"
$nupkgFiles = Get-ChildItem -Path $releaseFolder -Filter *.nupkg -File
foreach ($file in $nupkgFiles)
{
Copy-Item $file.FullName -Destination "Packages"
}
}
$VSFolder = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional"
$MsBuildExe = "$VSFolder\MSBuild\15.0\Bin\MSBuild.exe"
& $MsBuildExe AnyContainer.sln /t:pack "/p:Configuration=Release;Platform=Any CPU"; ExitIfFailed
if (!(Test-Path -Path "Packages"))
{
New-Item -ItemType Directory -Path "Packages"
}
$projectFolders = Get-ChildItem -Path .\ -Directory -Name
foreach ($pFolder in $projectFolders)
{
if ($pFolder.StartsWith("AnyContainer"))
{
CopyNupkg $pFolder
}
}