-
Notifications
You must be signed in to change notification settings - Fork 66
/
make-package.ps1
60 lines (44 loc) · 1.96 KB
/
make-package.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
$formsVersion = "5.0.0.1874"
$orgName = "Sharpnado"
$projectName = "Tabs"
$netstandardProject = ".\$projectName\$projectName\$projectName.csproj"
$droidProject = ".\$projectName\$projectName.Droid\$projectName.Droid.csproj"
$iosProject = ".\$projectName\$projectName.iOS\$projectName.iOS.csproj"
$uwpProject = ".\$projectName\$projectName.UWP\$projectName.UWP.csproj"
$droidBin = ".\$projectName\$projectName.Droid\bin\Release"
$droidObj = ".\$projectName\$projectName.Droid\obj\Release"
rm *.txt
echo " Setting Xamarin.Forms version to $formsVersion"
$findXFVersion = '(Xamarin.Forms">\s+<Version>)(.+)(</Version>)'
$replaceString = "`$1 $formsVersion `$3"
(Get-Content $netstandardProject -Raw) -replace $findXFVersion, "$replaceString" | Out-File $netstandardProject
(Get-Content $droidProject -Raw) -replace $findXFVersion, "$replaceString" | Out-File $droidProject
(Get-Content $iosProject -Raw) -replace $findXFVersion, "$replaceString" | Out-File $iosProject
(Get-Content $uwpProject -Raw) -replace $findXFVersion, "$replaceString" | Out-File $uwpProject
echo " deleting android bin-obj folders"
rm -Force -Recurse $droidBin
rm -Force -Recurse $droidObj
echo " cleaning $orgName.$projectName solution"
msbuild .\$projectName\$projectName.sln /t:Clean
if ($LastExitCode -gt 0)
{
echo " Error while cleaning solution"
return
}
echo " restoring $orgName.$projectName solution packages"
msbuild .\$projectName\$projectName.sln /t:Restore
if ($LastExitCode -gt 0)
{
echo " Error while restoring packages"
return
}
echo " building $orgName.$projectName solution"
msbuild .\$projectName\$projectName.sln /t:Build /p:Configuration=Release
if ($LastExitCode -gt 0)
{
echo " Error while building solution"
return
}
$version = (Get-Item $projectName\$projectName\bin\Release\netstandard2.0\$orgName.$projectName.dll).VersionInfo.FileVersion
echo " packaging $orgName.$projectName.nuspec (v$version)"
nuget pack .\$orgName.$projectName.nuspec -Version $version