I\'ve copied my project to a clean Windows 10 machine with only Visual Studio 2015 Community and SQL Server 2016 Express installed. There are no other framework versions ins
I have same issue and only way how i am able to fix it is add bindingRedirect to app.confing how wrote @tripletdad99.
But if you have solution with more project is really suck update every project by hand (and also sometimes after update some nuget package you need to do it again). And it is reason why i wrote simple powershell script which if all app.configs.
param(
[string]$SourceDirectory,
[string]$Package,
[string]$OldVersion,
[string]$NewVersion
)
Write-Host "Start fixing app.config in $sourceDirectory"
Write-Host "$Package set oldVersion to $OldVersion and newVersion $NewVersion"
Write-Host "Search app.config files.."
[array]$files = get-childitem $sourceDirectory -Include app.config App.config -Recurse | select -expand FullName
foreach ($file in $files)
{
Write-Host $file
$xml = [xml](Get-Content $file)
$daNodes = $xml.configuration.runtime.assemblyBinding.dependentAssembly
foreach($node in $daNodes)
{
if($node.assemblyIdentity.name -eq $package)
{
$updateNode = $node.bindingRedirect
$updateNode.oldVersion = $OldVersion
$updateNode.newVersion =$NewVersion
Write-Host "Fix"
}
}
$xml.Save($file)
}
Write-Host "Done"
Example how to use:
./scripts/FixAppConfig.ps1 -SourceDirectory "C:\project-folder" -Package "System.Net.Http" -OldVersion "0.0.0.0-4.3.2.0" -NewVersion "4.0.0.0"
Probably it is not perfect and also it will be better if somebody link it to pre-build task.