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)\s*(.*?)\s*' $vers = if ($fileContent -match $pattern) { $matches[1] } else { $null } echo "Versione corrente: $vers" # calcolo Rel e Build... $Release = (Get-Date).Month; $Build = get-date -format dHH; $parts = $vers -split '\.' #$newVers = "$parts[0].$parts[1].$Release.$Build" $newParts = @($parts[0], $parts[1], $Release, $Build) $newVers = $newParts -join '.' echo "Versione calcolata: $newVers" $findVers = "(.|\n)*?"; $replVers = "" + $newVers + ""; $newContent = $fileContent -replace $findVers, $replVers; Set-Content -Path $ProjectPath -Value $newContent; echo "Modifica dati file progetto x nuspec completata su file $ProjectPath"