Visual Studio .AddIn File Encoding Error
May 14th, 2010
No comments
If you’re testing the installer for your Visual Studio Add-In and you get the following error when launching Visual Studio:
"Switch from current encoding to specified encoding not supported"
and your .AddIn file looks completely normal when you open it in a text editor, then you're most likely not writing your .AddIn file in Unicode. Since the .AddIn usually specifies:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
Visual Studio expects the file type to be Unicode, so if you wrote your .AddIn file to disk using something like:
File.WriteAllText(addinFile, addInConfig);
You'll need to adapt your code to something like:
File.WriteAllText(addinFile, addInConfig, System.Text.Encoding.Unicode);
To make sure that the file is Unicode.
Hope that helps!
Categories: Extensibility, Visual Studio