forked from twilio/twilio-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
87 lines (63 loc) · 3.67 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
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
function Header ($message) {
Write-Host "`n== $message ==" -foregroundcolor yellow
}
try {
msbuild /t:clean /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
# .NET Framework 3.5 Target & Tests
Header "Building for .NET Framework 3.5"
msbuild /t:restore /p:TargetFramework=net35 /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
msbuild /p:TargetFramework=net35 /p:Configuration=Release /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
Header "Testing on .NET Framework 3.5"
.\test\Twilio.Test\bin\Release\net35\win7-x86\Twilio.Test.exe
if ($lastExitCode -ne 0) { exit $lastExitCode }
# .NET Framework 4.5.1 Target & Tests
Header "Building for .NET Framework 4.5.1"
msbuild /t:restore /p:TargetFramework=net451 /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
msbuild /p:TargetFramework=net451 /p:Configuration=Release /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
Header "Testing on .NET Framework 4.5.1"
.\test\Twilio.Test\bin\Release\net451\win7-x86\Twilio.Test.exe
if ($lastExitCode -ne 0) { exit $lastExitCode }
# .NET Standard 1.4 Target & Tests
Header "Building for .NET Standard 1.4"
msbuild .\src\Twilio\Twilio.csproj /t:restore /p:TargetFramework=netstandard1.4 /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
msbuild .\test\Twilio.Test\Twilio.Test.csproj /t:restore /p:TargetFramework=netcoreapp2.0 /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
msbuild .\src\Twilio\Twilio.csproj /p:TargetFramework=netstandard1.4 /p:Configuration=Release /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
msbuild .\test\Twilio.Test\Twilio.Test.csproj /p:TargetFramework=netcoreapp2.0 /p:Configuration=Release /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
Header "Testing on .NET Standard 1.4"
dotnet run --framework netcoreapp2.0 --project .\test\Twilio.Test\Twilio.Test.csproj
if ($lastExitCode -ne 0) { exit $lastExitCode }
# .NET Standard 2.0 Target & Tests
Header "Building for .NET Standard 2.0"
msbuild .\src\Twilio\Twilio.csproj /t:restore /p:TargetFramework=netstandard2.0 /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
msbuild .\test\Twilio.Test\Twilio.Test.csproj /t:restore /p:TargetFramework=netcoreapp2.0 /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
msbuild .\src\Twilio\Twilio.csproj /p:TargetFramework=netstandard2.0 /p:Configuration=Release /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
msbuild .\test\Twilio.Test\Twilio.Test.csproj /p:TargetFramework=netcoreapp2.0 /p:Configuration=Release /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
Header "Testing on .NET Standard 2.0"
dotnet run --framework netcoreapp2.0 --project .\test\Twilio.Test\Twilio.Test.csproj
if ($lastExitCode -ne 0) { exit $lastExitCode }
# Create the NuGet Package
Header "Building NuGet Package"
msbuild .\src\Twilio\Twilio.csproj /t:pack /p:Configuration=Release /verbosity:minimal
if ($lastExitCode -ne 0) { exit $lastExitCode }
Move-Item src\Twilio\bin\Release\Twilio.*.nupkg .\
if ($lastExitCode -ne 0) { exit $lastExitCode }
} catch {
Write-Host ""
Write-Host "Caught an exception:" -ForegroundColor Red
Write-Host "Exception Type: $($_.Exception.GetType().FullName)" -ForegroundColor Red
Write-Host "Exception Message: $($_.Exception.Message)" -ForegroundColor Red
exit 1
}