-
-
Save evilpilaf/7b17ca99a58d4f053ffb6fcba9eb01f4 to your computer and use it in GitHub Desktop.
Print out the binding redirects in a bin folder. Run from the build output directory.
This file contains 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 characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment