forked from DynamicsValue/fake-xrm-easy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpack-configuration.ps1
67 lines (60 loc) · 1.94 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
param (
[string]$versionSuffix = "",
[string]$targetFrameworks = "net6.0",
[string]$configuration = "FAKE_XRM_EASY_9"
)
Write-Host "Packing configuration $($configuration)..."
$project = "FakeXrmEasy"
$packageId = $project;
if($configuration -eq "FAKE_XRM_EASY_9")
{
$packageId = $('"' + $project + '.v9"')
}
elseif($configuration -eq "FAKE_XRM_EASY_365")
{
$packageId = $('"' + $project + '.v365"')
}
elseif($configuration -eq "FAKE_XRM_EASY_2016")
{
$packageId = $('"' + $project + '.v2016"')
}
elseif($configuration -eq "FAKE_XRM_EASY_2015")
{
$packageId = $('"' + $project + '.v2015"')
}
elseif($configuration -eq "FAKE_XRM_EASY_2013")
{
$packageId = $('"' + $project + '.v2013"')
}
else
{
$packageId = $('"' + $project + '.v2011"')
Write-Host $packageId
}
Write-Host "Running with versionSuffix '$($versionSuffix)'..."
$tempNupkgFolder = './nupkgs'
Write-Host "Packing assembly for targetFrameworks $($targetFrameworks)..."
if($targetFrameworks -eq "all")
{
if($versionSuffix -eq "")
{
dotnet pack --configuration $configuration /p:PackageId=$packageId -p:Title=$packageId -o $tempNupkgFolder src/$project/$project.csproj
}
else {
dotnet pack --configuration $configuration /p:PackageId=$packageId -p:Title=$packageId -o $tempNupkgFolder src/$project/$project.csproj --version-suffix $versionSuffix
}
}
else
{
if($versionSuffix -eq "")
{
dotnet pack --configuration $configuration /p:PackageId=$packageId -p:Title=$packageId -p:TargetFrameworks=$targetFrameworks -o $tempNupkgFolder src/$project/$project.csproj
}
else {
dotnet pack --configuration $configuration /p:PackageId=$packageId -p:Title=$packageId -p:TargetFrameworks=$targetFrameworks -o $tempNupkgFolder src/$project/$project.csproj --version-suffix $versionSuffix
}
}
if(!($LASTEXITCODE -eq 0)) {
throw "Error when packing the assembly"
}
Write-Host $("Pack $($packageId) Succeeded :)") -ForegroundColor Green