1

I'm updating a C# application to .NET 4.0. The older application uses several third party DLLs which are needed to be upgraded from version 2509.0.0.0 to 3396.0.0.0.

In the older application, the app.config file contains several of the following kind of nodes:

<configSections>
    <section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" />
</configSections>
.
.
.
<cachingConfiguration defaultCacheManager="Users">
<cacheManagers>
  <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="100000" numberToRemoveWhenScavenging="0" backingStoreName="Isolated Storage" name="SendQueues" />
  <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="Null Storage" name="ServiceUrls" />
  <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="10" numberToRemoveWhenScavenging="1" backingStoreName="Null Storage" name="MonitorData" />
  <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="10" numberToRemoveWhenScavenging="1" backingStoreName="Null Storage" name="Shipments" />
  <add expirationPollFrequencyInSeconds="5" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="Tag Collection Storage" name="TagCollections" />
  <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="UserIsolatedStorage" name="Users" />
  <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="WebProxyIsolatedStorage" name="WebProxy" />
  <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="0" backingStoreName="InterfaceMapIsolatedStorage" name="InterfaceMap"/>
  <add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="RememberMeIsolatedStorage" name="RememberMe" />
</cacheManagers>
<backingStores>
  <add partitionName="WebProxy" encryptionProviderName="WebProxyEncryption" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="WebProxyIsolatedStorage" />
  <add partitionName="SendQueues" encryptionProviderName="SendQueues Encryption" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="Isolated Storage" />
  <add partitionName="TagCollections" encryptionProviderName="Tags Cache Encryption" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="Tag Collection Storage" />
  <add partitionName="User" encryptionProviderName="Symmetric Storage Encryption" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="UserIsolatedStorage" />
  <add encryptionProviderName="" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="Null Storage" />
  <add partitionName="RememberMe" encryptionProviderName="Remember me Storage Encryption" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="RememberMeIsolatedStorage" />
  <add partitionName="InterfaceMap" encryptionProviderName="InterfaceMap Encryption" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.IsolatedStorageBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="InterfaceMapIsolatedStorage"/>
</backingStores>
<encryptionProviders>
  <add symmetricInstance="DPAPI Symmetric Cryptography Provider" type="Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography.SymmetricStorageEncryptionProvider, Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="WebProxyEncryption" />
  <add symmetricInstance="DPAPI Symmetric Cryptography Provider" type="Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography.SymmetricStorageEncryptionProvider, Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="SendQueues Encryption" />
  <add symmetricInstance="DPAPI Symmetric Cryptography Provider" type="Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography.SymmetricStorageEncryptionProvider, Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="Tags Cache Encryption" />
  <add symmetricInstance="DPAPI Symmetric Cryptography Provider" type="Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography.SymmetricStorageEncryptionProvider, Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="Symmetric Storage Encryption" />
  <add symmetricInstance="DPAPI Symmetric Cryptography Provider" type="Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography.SymmetricStorageEncryptionProvider, Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="Remember me Storage Encryption" />
  <add symmetricInstance="DPAPI Symmetric Cryptography Provider" type="Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography.SymmetricStorageEncryptionProvider, Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography, Version=2509.0.0.0, Culture=neutral, PublicKeyToken=ecdd5b3dfcfef3bb" name="InterfaceMap Encryption"/>
</encryptionProviders>

Notice that there are references to numerous DLLs with version number 2509.0.0.0. I have the version 3396.0.0.0 of each of those DLLs. It is tempting to modify all version numbers from 2509.0.0.0 to 3396.0.0.0 in the app.config file, but I believe that's not the proper way to do it.

The older version of the application was developed by someone else. How did they generate such an app.config file? How can I generate necessary nodes in the app.config file for version 3396.0.0.0 of all those DLLs?

Donotalo
  • 12,748
  • 25
  • 83
  • 121
  • For your case, it seems to be not so good idea - unless you understand exactly what you are doing - one character mistake may cause disaster... – Ian Apr 14 '16 at 05:56
  • @Ian: I agree. But what can I do? What's the best approach for this case? – Donotalo Apr 14 '16 at 05:57
  • Do the public tokens of the newer dll versions changed too? – Ian Apr 14 '16 at 05:59
  • @Ian: I've just checked for one public key. It hasn't changed. Not sure about the others. I've the .manifest files of all newer DLLs. – Donotalo Apr 14 '16 at 06:06
  • OK, in that case, you could probably change only the versions safely... What would I do in such case? Well, I have *never* done that to be honest... But theoretically, you could make a program use XmlDocument reader and then gets each XmlElement, and then check if the public token is the same, replace the version. If not, leave it alone. In any case, but don't forget to make the original copy of your `app.config`. If you fail, then you could get back your original `config` file. You could also try manually change it too. But in either case, seems like you are in pretty tight situation there... – Ian Apr 14 '16 at 06:10

1 Answers1

0

I've not been working with .NET for almost 2yrs, but as I still remember, there can be 2 ways to make your wish come true :)

  1. You can re-generate your app.config file by updating your project settings, should check the pre-build option.
  2. Manually replace in app.config file, it won't be that harmful :)

Good luck!

An Pham
  • 1
  • 1
  • I want to go with option 1. How can I update the project settings file to suit my need? Please check my post to find out what exactly I need. – Donotalo Apr 14 '16 at 07:57
  • If you're using Visual Studio, can follow this instructions to access project property, then make changes as you want to: https://msdn.microsoft.com/en-us/library/z15yzzew.aspx – An Pham Apr 14 '16 at 16:06
  • I'm using VS, but the contents of app.config file that I want to modify haven't come from project property. – Donotalo Apr 15 '16 at 04:32