22 lines
894 B
PowerShell
22 lines
894 B
PowerShell
param([string]$ProjectPath);
|
|
|
|
|
|
# Gestione calcolata numero Versione del componente: Major/Minor da gestire a mano, Rel e Build ricalcolate in compilazione
|
|
|
|
echo "Modifica dati versione pacchetto nuget"
|
|
$fileContent = Get-Content $ProjectPath -Raw;
|
|
$pattern = '(?i)<Version>\s*(.*?)\s*</Version>'
|
|
$vers = if ($fileContent -match $pattern) { $matches[1] } else { $null }
|
|
echo "Versione corrente: $vers"
|
|
# calcolo Rel e Build...
|
|
$Release = get-date -format M;
|
|
$Build = get-date -format ddHH;
|
|
$newVers = $vers -replace '^(\d+)\.(\d+)\.(\d+)\.(\d+)$', '$1.$2.$Release.$Build'
|
|
echo "Versione calcolata: $newVers"
|
|
$findVers = "<Version>(.|\n)*?</Version>";
|
|
$replVers = "<Version>" + $env:NUM_REL + "</Version>";
|
|
$newContent = $fileContent -replace $findVers, $replVers;
|
|
Set-Content -Path $ProjectPath -Value $newContent;
|
|
echo "Modifica dati file progetto x nuspec completata su file $ProjectPath"
|
|
|