mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 12:06:58 +00:00
Adds PowerShell Script for updating assembly version number
This commit is contained in:
parent
6725266ad9
commit
15c6da43eb
1 changed files with 48 additions and 0 deletions
48
PepperDashEssentials/Properties/UpdateAssemblyVersion.ps1
Normal file
48
PepperDashEssentials/Properties/UpdateAssemblyVersion.ps1
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
Set-ExecutionPolicy RemoteSigned
|
||||||
|
function Usage
|
||||||
|
{
|
||||||
|
echo "This is ";
|
||||||
|
echo “Usage: “;
|
||||||
|
echo ” from cmd.exe: “;
|
||||||
|
echo ” powershell.exe SetVersion.ps1 2.8.3.0″;
|
||||||
|
echo ” “;
|
||||||
|
echo ” from powershell.exe prompt: “;
|
||||||
|
echo ” .\SetVersion.ps1 2.8.3.0″;
|
||||||
|
echo ” “;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Update-SourceVersion
|
||||||
|
{
|
||||||
|
Param ([string]$Version)
|
||||||
|
$NewVersion = ‘AssemblyVersion(“‘ + $Version + ‘.*”)’;
|
||||||
|
foreach ($o in $input)
|
||||||
|
{
|
||||||
|
Write-output $o.FullName
|
||||||
|
$TmpFile = $o.FullName + “.tmp”
|
||||||
|
get-content $o.FullName |
|
||||||
|
%{$_ -replace ‘AssemblyVersion\("(\d+\.\d+\.\d+)\.\*"\)’, $NewVersion } > $TmpFile
|
||||||
|
move-item $TmpFile $o.FullName -force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Update-AllAssemblyInfoFiles ( $version )
|
||||||
|
{
|
||||||
|
foreach ($file in “AssemblyInfo.cs”, “AssemblyInfo.vb” )
|
||||||
|
{
|
||||||
|
get-childitem -recurse |? {$_.Name -eq $file} | Update-SourceVersion $version ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# validate arguments
|
||||||
|
$r= [System.Text.RegularExpressions.Regex]::Match($args[0], “^\d+\.\d+\.\d+$”);
|
||||||
|
if ($r.Success)
|
||||||
|
{
|
||||||
|
Update-AllAssemblyInfoFiles $args[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo ” “;
|
||||||
|
echo “Bad Input!”
|
||||||
|
echo ” “;
|
||||||
|
Usage ;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue