Assembly Redirection does not work

G

Guest

Hello,

I am having a hard time redirecting a VB.Net assembly. The old and new
assemblies are version major 1 and minor 0. The build and revision number
are different.
1.0.1519.15373 to 1.0.9.9

I tried creating binding policy using the same keyfile as the original and
new assembly and a config file. I named the new policy assembly
Policy.1.0.MyAssembly.dll. That didn't work. I looked in the .Net
Configuration tool under configured assemblies, and their was a binding
redirect to the new version. That also updated my machine.config

That didn't work. Private web application assemblies on my machine are
still referencing the old assembly.

I also tried adding the new assembly to the GAC, and inserting something
into the machine.config manually and that didn't work.

What am I doing wrong?

Also, If I change an assembly redirection, do I have to restart my machine?
or what should I do.

Thanks for your help.
 
S

Steven Cheng[MSFT]

Hi Mike,

As for the redrection problem you mentioned, I'm thinking whether there is
something incorrect with the Redirection config. Have you tried test the
redirection in a simple winform or console app and use a app.config to
specify the redirction. Based on my local test , I can correctly get the
redirection work in both a winform and asp.net app. The <bindingRedirect>
is specified in app.conifg (and web.config). Also, I didn't use
PublisherPolicy assembly and didn't put the assembly in GAC yet, my config
file is like below;

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MyLib"
publicKeyToken="0558bab96e18ec01"
culture="neutral" />

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

<codeBase version="1.0.9.9"

href="file:///D:\workspace\dotnet\CS\AsmVersionApp\MyLib\asms\V1.0.9.9\MyLib
..dll"/>

</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

================================

I use codeBase here to specify the location of the "1.0.9.0" assembly( no
need to do this is put in GAC).

You can have a try and let me know if you have any further problem.
BTW, though I put the strong-named assembly in private bin when testing in
asp.net, it is recommend that all the strong-named assembles put into GAC
when used in asp.net web app.

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top