ISWIX, LLC View Christopher Painter's profile on LinkedIn profile for Christopher Painter at Stack Overflow, Q&A for professional and enthusiast programmers

Monday, January 15, 2007

InstallShield XML Changes and .NET 2.0.

There has been a bug in InstallShield that has been reported on InstallSite.org and discussed various times on the InstallShield Community site. The bug involved the XML File Changes pattern authoring XML files as UTF-16 encoding instead of UTF-8 encoding. Personally I'd never given this bug much thought since my applications always seemed to work after installation. I'd even had a .NET developer who was far more experienced then myself look at the behavior and blow it off as `that shouldn't hurt anything.`

Well last week I noticed that a strange .NET 2.0 problem that I was having was partly caused by this behavior. It seems that the ConfigurationManager class in .NET is somewhat picky here. If I call the OpenEXEConfiguration method it will correctly load the AppSettings from an App.Config ( myapp.exe.config ) file that is authored in UTF-16/Unicode. However, when I made changes to the AppSettings and saved them back to the file, .NET would save the file in UTF-16/ANSI format. The next time I tried to call OpenEXEConfiguration the Framework would throw a Unicode exception. I'd have to open the file in Notepad and do a Save As Unicode to get it to work again.

Now I'm not the best C# developer in the world, but that seems like a bug. Why would the class save the file in a format that it can't read? Perhaps someone can explain this to me.

Now I've also noticed that if I create the XML to say the encoding is UTF-8 it always works whether it's ANSI or Unicode. The problem though was that InstallShield 12 would always write the XML changes as UTF-16.

Well, today MichaelU posted an unofficial hotfix on the InstallShield Community site. It contains an updated version of ISXmlCfg.dll that updates XML files in UTF-8. I've tested it and it solves my problem. Thanks Michael!

BTW, I couldn't help notice that the version # of the file is 14.0.0.58565. Hopefully we'll be seeing InstallShield 14 sometime soon. If I had to take a guess, I'd imagine that there will be a service pack to IS12 to make up for the fact that there wasn't a 12.5 and that IS 14 will be released later this spring or early summer since that's about 1 year since IS 12 was released.

No comments:

Post a Comment