mirror of
https://github.com/MichaelGrafnetter/DSInternals
synced 2025-01-10 08:20:02 +00:00
31 lines
1.0 KiB
PowerShell
31 lines
1.0 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Generates NuGet Packages.
|
|
#>
|
|
#Requires -Version 3
|
|
|
|
$repoRoot = Join-Path $PSScriptRoot '..\'
|
|
$solutionDir = Join-Path $repoRoot 'Src\'
|
|
$outputDir = Join-Path $repoRoot 'Build\packages\'
|
|
$toolsDir = Join-Path $repoRoot 'Scripts\Tools'
|
|
$nuget = Join-Path $toolsDir 'nuget.exe'
|
|
|
|
# Create output dir if it does not exist
|
|
mkdir $outputDir -Force
|
|
|
|
# Download nuget.exe to Tools
|
|
$nugetExeUrl = 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe'
|
|
|
|
if(-not (Test-Path $nuget))
|
|
{
|
|
mkdir $toolsDir
|
|
Invoke-WebRequest -Uri $nugetExeUrl -OutFile $nuget
|
|
}
|
|
|
|
# Pack all *.csproj files that have a corresponding *.nuspec file
|
|
Get-ChildItem -Path $repoRoot -Filter *.nuspec -Recurse -File |
|
|
ForEach-Object { $PSItem.FullName.Replace('.nuspec', '.csproj') } |
|
|
ForEach-Object {
|
|
$solutionFile = $PSItem
|
|
& $nuget pack $solutionFile -OutputDirectory $outputDir -IncludeReferencedProjects -Properties "Configuration=Release;Platform=x64;SolutionDir=$solutionDir" -Verbosity detailed -NonInteractive
|
|
} |