EntLibConfig XML adds Version=xxx question about this

Topics: General discussion, Validation Application Block
Feb 26, 2010 at 12:00 AM

Hello everyone,

I have a Windows Form Application called WindowsFormsApplication117. In the AssemblyInfo I have set the AssemblyVersion=[assembly: AssemblyVersion("1.0.*")] so visual studio automatically increments the builds.

I run EntLibConfig and I create a Validation Application Block.

In the xml the first thing I see is this:

 

<configSections>
    <section name="validation" type="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings, Microsoft.Practices.EnterpriseLibrary.Validation, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>

 

As you can see, in the type attribute there is a Version=4.1.0.0

What does that mean or do? What is the purpose of having that? If I delete Version=4.1.0.0 the application still runs well i.e.:

<configSections>
    <section name="validation" type="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings, Microsoft.Practices.EnterpriseLibrary.Validation, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>

Then I have this

<validation>
    <type assemblyName="WindowsFormsApplication117, Version=1.0.3708.33544, Culture=neutral, PublicKeyToken=null"
      name="WindowsFormsApplication117.Test">

Again, as you can see in the assemblyName attribute there is a Version=1.0.3708.33544

What does that mean or do? What is the purpose of having that? If I delete Version=1.0.3708.33544 the application still runs well i.e

<validation>
    <type assemblyName="WindowsFormsApplication117, Culture=neutral, PublicKeyToken=null"
      name="WindowsFormsApplication117.Test">

Thanks a lot

Feb 26, 2010 at 5:38 AM

Hi,

As I understand, the version is used for resolving specific assembly (strong named assemblies). Those version are automatically added by the ent lib config tool since that it (the config tool) uses the strong named assembliles of ent lib.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Feb 26, 2010 at 4:23 PM

Thanks for getting back to me.

So basically the version is only used by the Enterprise Library Config Tool, which means that the version is irrelevant or not used by the enterprise library engine/API. Is this correct?

Thanks

Mar 1, 2010 at 4:53 AM

I think API, in general, simply uses the available assembly it finds, it doesn't care about the version number.  The version number is part of the identity of an assembly.  When you start an application, it first loads all the assemblies specified in the config file.  So, if you specified a different version number in your config and referenced a different version of that assembly, that's what would cause problems.  It won't be able to load that particular assembly since it can't find it.  When you didn't specified the version number, it still works because it performed a partial binding (http://www.techbubbles.com/net-framework/assembly-binding-in-net-framework/). 

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com