-
-
Notifications
You must be signed in to change notification settings - Fork 10
Autogenerating Binding Redirects
The template will, on compile, generate a copy of the current web.config
with any required binding redirects added.
This file is written to the bin
folder with the name AssemblyName.dll.config
where AssemblyName
is the name of your assembly.
You can set the AssemblyName
by adding
<AssemblyName>MyAssemblyName</AssemblyName>
to your project file as normal.
If you get the error Warning MSB3276 Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. <project name here>
, then you can manually copy the
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>
</runtime>
section from the generated .dll.config
file to your web.config file, replacing the existing assemblyBinding
node.
Alternatively, since the .dll.config
file is based on your web.config
file, you can just overwrite your web.config
file with the .dll.config
file.
If you want this to happen automatically, you can add the following to your project file.
<Target Name="UpdateWebConfigBindingRedirects" AfterTargets="CopyFilesToOutputDirectory">
<Copy SourceFiles="$(OutDir)$(AssemblyName).dll.config" DestinationFiles="web.config" />
</Target>
N.B. This may confuse your source code control and make VS always think your project is 'dirty' and cause recompiles as the file will be over-written on each compile.