-
-
Save evilpilaf/7b17ca99a58d4f053ffb6fcba9eb01f4 to your computer and use it in GitHub Desktop.
Revisions
-
dburriss created this gist
Feb 27, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ function Find-Dlls() { $dlls = Get-ChildItem | ? { $_.Extension -eq '.dll' } | % { [System.Reflection.AssemblyName]::GetAssemblyName($_.FullName).FullName } return $dlls } function Set-Bindings() { $binding = "<dependentAssembly> <assemblyIdentity name=`"{0}`" publicKeyToken=`"{2}`" culture=`"neutral`" /> <bindingRedirect oldVersion=`"0.0.0.0-{1}`" newVersion=`"{1}`" /> </dependentAssembly>" $dlls = Find-Dlls $bindings = new-object string[] $dlls.length for ($i=0; $i -lt $dlls.length; $i++) { $values = $dlls[$i] -replace "([^,]+), Version=([^,]+), Culture=neutral, PublicKeyToken=(.*)", '$1,$2,$3' $current = $binding -f $values.split(",") $bindings[$i] = $current } foreach($binding in $bindings){ Write-Host $binding } } Set-Bindings()