0

I want version my DLL with every build and release for that i have used powershell script as :

 foreach ($file in $files) {
    $filecontent = Get-Content($file)
    echo "updating version for $file"
    attrib $file -r
    $filecontent | %{$_ -replace 'AssemblyVersion\("[0-9]+?(\.([0-9]+?|\*)){1,3}"\)', $('AssemblyVersion("' + $NewVersion + '")') } |    
                  %{$_ -replace 'AssemblyFileVersion\("[0-9]+?(\.([0-9]+?|\*)){1,3}"\)', $('AssemblyFileVersion("' + $NewVersion + '")') } | 
                  %{$_ -replace '<AssemblyVersion>[0-9]+?(\.([0-9]+?|\*)){1,3}<', $('<AssemblyVersion>' + $NewVersion + '<') } | 
                  %{$_ -replace '<FileVersion>[0-9]+?(\.([0-9]+?|\*)){1,3}<', $('<FileVersion>' + $NewVersion + '<') } |
                  %{$_ -replace '<Version>[0-9]+?(\.([0-9]+?|\*)){1,3}<', $('<Version>' + $NewVersion + '<') } | Out-File -Encoding "UTF8" $file

But earlier i was using azure/on premise build server on which versioning was working properly.

No i switched to hosted agent, Powershell script task runs successfult but version of dll remains as 1.0.0.

Any solution to get this work on Hotsed agent as well ?

S2K
  • 1,185
  • 3
  • 27
  • 55

0 Answers0