I’ll preface my answers about support for VSTA in Windows 7 and Visual Studio 2010 with a quick synopsis of VSTA 2.0 platform-related elements.
VSTA 2.0 is based on VS2008 and .NET 3.5 SP1. It supports 32-bit and 64-bit platforms.
· The VSTA integrated development environment creates projects similar to VS2008 that target .NET 3.5 SP1 exclusively.
· The VSTA IDE supports VB and C# languages and compilers for .NET 3.5 SP1 exclusively.
· VSTA’s integrated debugger supports versions of the .NET framework that run on CLR 2 -- .NET 3.5 SP1 or previous framework versions.
· The VSTA runtime is built on System.AddIn, introduced in .NET 3.5. Use of the runtime adds considerable complexity and is not recommended for most use cases.
Windows 7 support: VSTA is fully supported under Windows 7 (both 64 and 32-bit).
Visual Studio 2010 support: VSTA is supported under VS2010 in a limited way, described as follows:
· For the most compatible VSTA/VS2010 scenario, build your application and integrate VSTA 2.0 with VS2010, selecting .NET 3.5 SP1 as the ‘Target framework’. This approach will allow you to use fully utilize VSTA’s design time and runtime capabilities.
· The CLR 4.0 will run .NET assemblies built with earlier versions of the .NET framework, including .NET 3.5 assemblies created by VSTA.
Therefore, if you wish to use VSTA to automate your application built with .NET 4.0 as the target framework:
o You can execute VSTA scripts to automate the application, but these scripts must use an application automation layer assembly built on .NET 3.5 SP1 or earlier. VSTA scripts (add-in assemblies) cannot load assemblies built for the .NET 4.0 platform.
o At design time, VSTA projects (created with VS 2008 or VSTA 2.0) cannot set reference to or load assemblies built for the .NET 4.0 platform. “The referenced component ‘<assembly name>’ could not be found.” As already mentioned, using an automation layer built with .NET 3.5 SP1 means that your application’s object model or automation layer cannot contain types or features that are new with .NET 4.0. VSTA’s support of VB and C# languages does not reflect .NET 4.0 changes.
o Both VS 2008 IDE and the VSTA 2.0 IDE will not debug a .NET 4.0 application as the start-up application. Instead an error is thrown when starting the project: “The debugger’s protocol is incompatible with the debuggee“. I assume that the problem is caused with host app targeting .NET 4.0 & CLR 4.0 -- since VS2008 only supports up to .NET 3.5, the debugger is unable to correctly attach to a 4.0 managed process (or it doesn’t support .NET 4.0 debugger protocols).
o I’ve encountered a reflection problem when gathering type information (Type t; t.GetMethods();) that only occurs when a .NET 4.0 host application interrogates a VSTA assembly (built on .NET 3.5).
o VS2010 will not open or convert VSTA 2.0 projects (and vice-versa).
Practically speaking, then, integrating VSTA 2.0 with an application built for .NET 4.0 is limited to VSTA script execution. The VSTA script must be created and debugged in a .NET 3.5 context.
Microsoft continues to invest in VSTA as the .NET solution for end user scripting. Presently, Microsoft has not disclosed a timeframe for VSTA support of .NET 4.0.
Testing on a clean computer with only .NET framework version 4.0 installed demonstrates that your application installer must continue to follow VSTA deployment guidelines and include the correct, previous version of the .NET framework as an installer pre-requisite.
Oct 07 2010, 01:01 PM