-
Notifications
You must be signed in to change notification settings - Fork 0
/
Release.ps1
89 lines (81 loc) · 2.37 KB
/
Release.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function ExitWithCode
{
param
(
$exitcode
)
$host.SetShouldExit($exitcode)
exit
}
[string] $VSCOMNTOOLS
[string] $Architecture = (Get-Process -Id $PID).StartInfo.EnvironmentVariables["PROCESSOR_ARCHITECTURE"];
if(Test-Path ${env:VS120COMNTOOLS})
{
$VSCOMNTOOLS = ${env:VS120COMNTOOLS}
}
elseif(Test-Path ${env:VS110COMNTOOLS})
{
$VSCOMNTOOLS = ${env:VS110COMNTOOLS}
}
elseif(Test-Path ${env:VS100COMNTOOLS})
{
$VSCOMNTOOLS = ${env:VS100COMNTOOLS}
}
elseif(Test-Path ${env:VS90COMNTOOLS})
{
$VSCOMNTOOLS = ${env:VS90COMNTOOLS}
}
else
{
Write-Error "Visual Studio Environment Variable not found"
ExitWithCode 1
}
[string] $VSCOMNTOOLSPATH = "$VSCOMNTOOLS..\..\VC\"
pushd "$VSCOMNTOOLSPATH"
cmd /c "vcvarsall.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
write-host "`nVisual Studio Command Prompt variables set." -ForegroundColor Yellow
$Root = Get-Item (Split-Path $MyInvocation.MyCommand.Path -Parent)
Write-Host $Root
$Solution = Get-ChildItem $Root "PK.Application.sln" -File
Write-Host $Solution.FullName
$TestResult = Get-ChildItem $Root "TestResults" -Directory
Write-Host $TestResult.FullName
$Sources = Get-ChildItem $Root "Sources" -Directory
Write-Host $Sources.FullName
$Tests = Get-ChildItem $Root "Tests" -Directory
Write-Host $Tests.FullName
$Package = Get-ChildItem $Root "Package" -Directory
Write-Host $Package.FullName
$Packages = Get-ChildItem $Root "packages" -Directory
Write-Host $Packages.FullName
if(Get-Command "NuGet.exe" -ErrorAction SilentlyContinue)
{
$NuGet = (Get-Command "NuGet.exe").Path
}
else
{
$NuGet = Get-ChildItem $Root -Recurse -File | Where-Object { $_.Name -EQ "NuGet.exe" } | Select-Object -First 1
if($NuGet)
{
$NuGet = $NuGet.FullName
}
else
{
Invoke-WebRequest https://www.nuget.org/nuget.exe -OutFile $env:temp\NuGet.exe
$NuGet = (Get-Item $env:temp\NuGet.exe).FullName
}
}
Write-Host "Using: $NuGet"
$PKApplication = Get-ChildItem $Sources "PK.Application" -Directory
Write-Host $PKApplication.FullName
$PKApplicationProj = Get-ChildItem $PKApplication.FullName "PK.Application.csproj" -File
Write-Host $PKApplicationProj.FullName
#goto :eof
& $NuGet restore $Solution.FullName
& msbuild /t:Pack /p:Configuration=Release $PKApplicationProj.FullName /p:NuGetExePath=$NuGet