views:

474

answers:

4

I have a class library called "MyAssembly" that is internally referencing a.dll, b.dll of version 3.1.1.0; I have build the project which outputed MyAssembly.dll. On a different system (box) I have created a web application project and referenced the MyAssembly.dll. the new system has new versions of a.dll and b.dll 4.0.0; I used binding redirect in web.config like below. But still unable to compile the web application. it says missing assembly reference a.dll, version 3.1.1.0.

Could any body help in solving this issue?

Thanks, Suresh

A: 

This should work.

<runtime>  
 <dependentAssembly>  
   <assemblyIdentity name="MyAssembly" publicKeyToken="12233444"/>  
   <bindingRedirect oldVersion="3.1.1.0" newVersion="4.0.0.0"/>  
 </dependentAssembly>  
</runtime>

Another suggestion: Remove the namespace from your configuration tag:

Instead of

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&gt;

try

<configuration>
Manu
I did exactly same. But no luck. While compiling the project in ide itself giving error saying " are you missing assemblyreference a.dll 3.1.1.0
Suresh
Configuration tag does not contain xmlns attribute. No Luck
Suresh
A: 

If you want to use version "3.1.1.0", give it to NewVersion. Your app is always going to use version mentioned in Newversion.

Lampan
A: 

You are using MyAssembly in your web application. The binding redirect will be used for this Assembly and not the assemblies which MyAssembly uses. Check the manifest for the MyAssembly.dll, it should be referring to the 3.1.1.0 versions of a.dll, hence the compiler error is shown. Build the MyAssembly with referring to a.dll of version 4.0.0.0 and then use the MyAssembly in your web application. This will work.

Sajeev
A: 

Try this way:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="a.dll"
                      publicKeyToken="{put a.dll publicKeytoken here}"
                      culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-99.99.99.99"
                     newVersion="4.0.0.0"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="b.dll"
                      publicKeyToken="{put b.dll publicKeytoken here}"
                      culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-99.99.99.99"
                     newVersion="4.0.0.0"/>
  </dependentAssembly>
</assemblyBinding>

Also, go to the references of your application, right click the a.dll and b.dll, go to properties and check if "Specific Version" is set to False.

Hope it helps.

andrecarlucci