Skip to content

Instantly share code, notes, and snippets.

@wilson0x4d
Created November 12, 2019 20:47
Show Gist options
  • Save wilson0x4d/6a72d855ef1caa70605d46ca967895db to your computer and use it in GitHub Desktop.
Save wilson0x4d/6a72d855ef1caa70605d46ca967895db to your computer and use it in GitHub Desktop.
#
# assigns $env:BUILD_VERSION as the `AssemblyVersion` and
# `AssemblyFileVersion` values for all "AssemblyInfo.cs"
# files under current directory.
#
Get-ChildItem -R AssemblyInfo.cs | %{ $_.FullName } | %{
cp $_ $('$_.tmp');
(Get-Content -Raw $('$_.tmp')) -replace '(AssemblyFileVersion|AssemblyVersion)\(\"[^\"]*',$('$1("' + $env:BUILD_VERSION) > $_;
}
Get-ChildItem -R AssemblyInfo.cs | %{ sls -Pattern 'Version' $_ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment