Whidbey VSTO Issue


My weekend was somewhat overshadowed by a rather sneaky Visual Studio Tools for Office issue in Whidbey Beta One; I've seen a few other people post on having encountered it but no-one thus far having fixed it. I found a brute force way of resolving it so thought I'd share - if anyone finds a better way do please spread the word.

The manifestation is pretty nasty - you do File -> New -> Project and then pick either Excel or Word templates, and then try to build and run. So it's pretty fundamental! It's a case of software rot - it all used to work and suddenly it breaks. VB or C#, Excel or Word. An exception is thrown:

"Type 'System.Security.Cryptography.SHA1CryptoServiceProvider' in Assembly 'mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable."

Naturally you read this as being an issue with the privilege level of the associated assembly, but when you try to elevate its permission set via the .NET Framework Wizard, you're told the assembly "can't be opened". ILDASM can read it, so it can be opened! Interestingly, the Wizard now says this to every assembly, VSTO or otherwise.

I had been playing with the security settings beforehand, trying to give an Action Pane user control (what a fabulous feature that is!) privilege to hit a local database, running the Yukon beta, so it's a lot of pre-release code conspiring to wreak havoc and probably very hard to trace as a bug for that reason.

I de- and re-installed Whidbey; no change. De-installing Yukon requires a reboot at every stage and Coronation Street was looming closer so time was against me. I decided that re-installing the .NET Framework 2.0 Beta might do the trick, but Framework 2 Beta doesn't appear in "Add/Remove Programs" nor in Windows Components.

Hence I am indebted to Sam Gentile's blog entry which outlines a very blunt way of de-installing Fx 2.0 and indeed the other beta bits:

"To remove Microsoft .NET Framework 2.0 Beta

msiexec.exe /x {71F8EFBF-09AF-418D-91F1-52707CDFA274}

If that fails, try:

msizap.exe TWA {71F8EFBF-09AF-418D-91F1-52707CDFA274}"

The first option did it for me - I reinstalled from the MSDN distribution and all is now fine. Sam, I owe you a beer.

Skip to main content