-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild-packages.ps1
48 lines (40 loc) · 1.48 KB
/
build-packages.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
[string]$scriptDir = split-path -parent $MyInvocation.MyCommand.Definition
function DeleteNuGetPackageCacheFolders{
[cmdletbinding()]
param(
[string[]] $packageIds=('sayedha.templates.tasks'),
[string] $nugetCacheFolder = (Join-Path $env:USERPROFILE '.nuget' 'packages')
)
process{
'DeleteNuGetPackageCacheFolders' | Write-Output
if(-not (test-path $nugetCacheFolder)){
throw 'NuGet cache folder not found at "{0}"' -f $nugetCacheFolder
}
foreach($pkgId in $packageIds){
$pathToLookFor = join-path $nugetCacheFolder $pkgId
if(test-path $pathToLookFor){
'Deleting nuget cache folder at "{0}"' -f $pathToLookFor | Write-Output
remove-Item -Path $pathToLookFor -Recurse
}
}
# $nugetCacheFolder
}
}
function BuildPackage{
[cmdletbinding()]
param(
[string]$projectPath = (Join-path $scriptDir 'src\sayedha.templates.tasks\sayedha.templates.tasks.csproj'),
[string]$buildConfig = 'Release'
)
process{
if(-not (test-path $projectPath)){
throw 'Project not found at "{0}"' -f $projectPath
}
# dotnet pack -c Release C:\data\mycode\dotnet-new-web\src\SayedHa.Templates.Tasks\SayedHa.Templates.Tasks.csproj -bl
dotnet pack -c $buildConfig $projectPath -bl
}
}
'Deleting any existing nuget caches'
DeleteNuGetPackageCacheFolders
'Building the package'
BuildPackage