ClickOnce versioning and assembly references in configuration

Topics: Building and extending application blocks, Exception Handling Application Block, General discussion
Apr 3, 2009 at 7:37 PM

I tried searching but couldn't find anything to help in my case so I apologize if this has been covered before and I just missed it.

Our application is using the Exception Handling Application Block of the Enterprise Library 4.0 and is being deployed via ClickOnce. In one of our assemblies we have defined a few custom exception handlers which are added with the integrated configuration tool and referenced by their full type name in the configuration file, ie:

    <add type="My.Namespace.MyCustomExceptionHandler, MyAssembly, Version=, Culture=neutral, PublicKeyToken=MyPublicKey:)"
        name="Custom Exception Handler" />

Now everything's working fine under our regular debug/release development builds within Visual Studio. However as part of our ClickOnce deployment the assembly versions are auto-incremented, so when running a deployed version we get the expected exception

"An error occurred creating the configuration section handler for exceptionHandling: Could not load file or assembly 'MyAssembly, Version=, Culture=neutral, PublicKeyToken=MyPublicKey:)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

because that's not the version it finds under the ClickOnce install. I found that if I remove the ", Version=" part of the type name everything works fine under our development builds and the ClickOnce deployment builds.

Now for my question... It's of course not ideal to not have a specific version referenced in the config file or to have to go in and remove the version number whenever we modify it with the configuration tool. Does anyone have any suggestions for elegantly handling this? Or should I just continue removing the version numbers from our configuration? Or maybe just scrap using configuration files and configure the EHAB programmatically?

Apr 8, 2009 at 10:08 AM
This is not an entlib issue, more of ClickOnce deployment.  Found this thread anyway, might be what you're looking for -

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.