bindingRedirect web.config

Topics: General
Jan 30, 2013 at 11:18 AM


We are creating nuget package that contains assembly..lets say MyModule.dll, which depends on...let's say MyServer.dll version 1.1. I want to install the package to a website that uses MyServer.dll version 1.0. For that purpose, all of the code that depends on version 1.1 is escaped by checking the version of the dependent assembly.

The problem is that when nuget installs the package, it changes the web.config as follows:

bindingRedirect oldVersion="" newVersion=""

but I want oldVersion to be If I later change it manually, it works. Basically I want MyModule.dll, which depends on MyServer v1.1 to work on an older server, which uses MyServer.dll v.1.0.

Is there any solution for this or how can I disable automatic binding redirect, so I will do this by using PowerShell script by myself.

Feb 3, 2013 at 4:32 PM
Unfortunately, there's no option to disable automatic binding redirect. You can either edit web.config manually or write PS script to remove it.
Feb 4, 2013 at 6:07 AM
The problem is that the PowerShell script is executed before the Nuget automatic binding redirect execution and therefore my changes are overwritten. The script is in the tools folder and it is named Install.ps1 as it is documented...
Feb 6, 2013 at 6:04 PM
You're correct. We should fix it so that install.ps1 is run after binding redirect execution.
Feb 6, 2013 at 6:05 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.