Fix versione calcolata

This commit is contained in:
Samuele Locatelli
2025-08-07 19:07:12 +02:00
parent 28ca2a7a4b
commit b8aac067a9
2 changed files with 16 additions and 5 deletions
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>2.7.8.0717</Version>
<Version>2.7.8.0719</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione JWD per LUX</Description>
@@ -33,3 +33,11 @@
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectPath $(ProjectPath)" />
</Target>
</Project>
+6 -3
View File
@@ -9,12 +9,15 @@ $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;
$Release = (Get-Date).Month;
$Build = get-date -format ddHH;
$newVers = $vers -replace '^(\d+)\.(\d+)\.(\d+)\.(\d+)$', '$1.$2.$Release.$Build'
$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 = "<Version>(.|\n)*?</Version>";
$replVers = "<Version>" + $env:NUM_REL + "</Version>";
$replVers = "<Version>" + $newVers + "</Version>";
$newContent = $fileContent -replace $findVers, $replVers;
Set-Content -Path $ProjectPath -Value $newContent;
echo "Modifica dati file progetto x nuspec completata su file $ProjectPath"