System.Net.Http Error After Visual Studio 15.8.1 (2017) Update

Today we started getting an error from three web applications.  Two were web services and one was an ASP.NET MVC website.  The error was:

Could not load file or assembly ‘System.Net.Http, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The error was occurring on this standard line in the global.asax file:


Looking at the trace statements on the error page, there was a mention of a binding redirect, which I recall seeing in the web.config of the site.  That section in the web config looked like:


    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">


        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>

        <bindingRedirect oldVersion="" newVersion=""/>




This config block had been in place since December, 2015.  The block seems to have been added by a NuGet package at the same time, possibly with a Framework version upgrade.

However it originally ended up there, removing the config block allowed the sites to launch again.  It’s unknown why this started happening after a Visual Studio upgrade.

Batch Applying MetaFLAC ReplayGain Tags To Recursive Album Folders

I’ve been ignoring PowerShell for a very long time, even though I know it is the future of scripting.  The structure of the language is very foreign, with all of the pipe options.  But I muddled through the examples I found online and came up with my first usable PowerShell script.

The purpose of the script is to iterate recursively through a folder structure and generate a command statement using all the files in each folder.  In this case, MetaFLAC is being called with arguments to apply ReplayGain tags to all the files in a folder.  To do this effectively, you have to pass all the file names in the folder on one command line.  This is so the overall album sound level can be calculated.

Without further introduction, here is the script:

    This script applies album-level and file-level
    ReplayGain tags to FLAC album folders recursively

    Example usage from PS command line:
    .\ReplayGain.ps1 -root:"c:\music\FLAC"

    MetaFLAC.exe must be in same folder or in environment PATH

    #Fully-qualified path to top-level folder.

Function CallMetaFLAC($d){
    Write-Host "Processing" ($d | Get-ChildItem -Filter "*.flac").length "files in" $d
    if (($d | Get-ChildItem -Filter "*.flac").length -gt 0){
        $args="–add-replay-gain "

        foreach ($f in ($d | Get-ChildItem -Filter "*.flac" | % {$_.FullName}) ){
            $args=$args + """$f"" "

        Start-Process "metaflac.exe" $args -Wait -NoNewWindow

    # Process Subfolders
    foreach($dd in $d | Get-ChildItem -Directory){
        CallMetaFLAC $dd

Write-Host "Starting in $root"

CallMetaFLAC $root

Write-Host "Ending"