Assembly binding - old and new version

P

Piotrekk

Hi

I have designed simple assembly ( *.dll - version 1.0.0.0 ) and
registered it in GAC. I have also compiled new version of this
assembly - 1.0.0.1 and also added to GAC.

Then I've created simple console application and added reference to
assembly 1.0.0.0 by pointing the file in "Browse" tab ( visual
studio ). So good so far. I have applied binding policy ( configured
assembles from .NET Framework 2.0 configuration tool ) in the
following way. requested version = 1.0.0.0 new version = 1.0.0.1

Then when I ran console application I have observed that new version
of assembly was used. The question is why can't I achieve the same
goal by just adding configuration file to console application.

When I run the app with the following config file, still the old
version is used ( tkAssembly is assembly name from GAC and token is
taken from version 1.0.0.0 of this assembly ):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="tkAssembly"
processorArchitecture="x86" publicKeyToken="565726153a63d68f"/>
<bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Thanks
PK
 
N

Nicholas Paldino [.NET/C# MVP]

Piotrekk,

I would try adding the namespace to the assemblyBinding element:

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

It's in all the examples for the documentation, and might be the key
here.
 

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