-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpack-configuration.ps1
73 lines (64 loc) · 2.61 KB
/
pack-configuration.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
param (
[string]$versionSuffix = "",
[string]$targetFrameworks = "netcoreapp3.1",
[string]$configuration = "FAKE_XRM_EASY_9",
[string]$projectName = "FakeXrmEasy.Abstractions",
[string]$projectPath = "src/FakeXrmEasy.Abstractions",
[string]$packageIdPrefix = "FakeXrmEasy.Abstractions",
[string]$packTests = ""
)
Write-Host "Packing configuration for project '$($projectName)' with '$($configuration)' and targetFramework '$($targetFrameworks)' at '$($projectPath)', packTests='$($packTests)'..." -ForegroundColor Yellow
$packageId = $packageIdPrefix;
if($configuration -eq "FAKE_XRM_EASY_9")
{
$packageId = $('"' + $packageIdPrefix + '.v9"')
}
elseif($configuration -eq "FAKE_XRM_EASY_365")
{
$packageId = $('"' + $packageIdPrefix + '.v365"')
}
elseif($configuration -eq "FAKE_XRM_EASY_2016")
{
$packageId = $('"' + $packageIdPrefix + '.v2016"')
}
elseif($configuration -eq "FAKE_XRM_EASY_2015")
{
$packageId = $('"' + $packageIdPrefix + '.v2015"')
}
elseif($configuration -eq "FAKE_XRM_EASY_2013")
{
$packageId = $('"' + $packageIdPrefix + '.v2013"')
}
else
{
$packageId = $('"' + $packageIdPrefix + '.v2011"')
Write-Host $packageId
}
$tempNupkgFolder = './nupkgs'
Write-Host "Building..."
./build.ps1 -targetFrameworks $targetFrameworks -configuration $configuration -packTests $packTests
Write-Host "Packing assembly for targetFrameworks $($targetFrameworks)..."
if($targetFrameworks -eq "all")
{
if($versionSuffix -eq "")
{
dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -o $tempNupkgFolder $projectPath/$projectName.csproj
}
else {
dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -o $tempNupkgFolder $projectPath/$projectName.csproj --version-suffix $versionSuffix
}
}
else
{
if($versionSuffix -eq "")
{
dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -p:TargetFrameworks=$targetFrameworks -o $tempNupkgFolder $projectPath/$projectName.csproj
}
else {
dotnet pack --no-build --configuration $configuration -p:PackageID=$packageId -p:Title=$packageId -p:PackTests=$packTests -p:TargetFrameworks=$targetFrameworks -o $tempNupkgFolder $projectPath/$projectName.csproj --version-suffix $versionSuffix
}
}
if(!($LASTEXITCODE -eq 0)) {
throw "Error when packing the assembly for package $($packageIdPrefix) and configuration $($configuration)"
}
Write-Host $("Pack $($packageId) Succeeded :)") -ForegroundColor Green