After hearing about it on the latest .NET Rocks! podcast, I set out to try the new VSTA SDK, and much to my surprise everything works up to one point: generating the project templates.  I followed the instruction in the MSDN Library addition it installed, and came up with the following instructions for how (I thought) to get the most basic sample, ShapeAppCSharp, to function with VSTA:


(All paths/command-line commands are in bold, the .reg file is in italics.  Copy them verbatim, quotes and all, and it will work fine.)


  1. Install VSTA to default location  (C:\Program Files\Visual Studio 2005 Tools for Applications SDK)
  2. Start - >Run -> msiexec /i "D:\Program Files\Visual Studio 2005 Tools for Applications SDK\2007.02\VisualStudioToolsForApplications\SetupPackage\vsta_aide.msi" VSTAINVS=1
  3. Extract: D:\Program Files\Visual Studio 2005 Tools for Applications SDK\2007.02\VisualStudioToolsForApplications\Samples\ShapeAppCSharp.zip to: C:\ShapeAppSamples
  4. Open C:\ShapeAppSamples\ShapeAppCSharp\ShapeAppCSharp.sln
  5. Add a new C# Class Library project to the solution named ShapeAppCSharpProxy
  6. Add a new set of references to the new project (All under the “.NET” tab):
    1. System.Drawing
    2. System.Windows.Forms
    3. System.AddIn
    4. Microsoft.VisualStudio.Tools.Applications.Adapter
    5. Microsoft.VisualStudio.Tools.Applications.Contract

 

  1. Open Project Properties for project ShapeAppCSharp
  2. Paste the following text into the “Post-build event command-line” box on the “Build Events” tab:

set proxygen="D:\Program Files\Visual Studio 2005 Tools for Applications SDK\2007.02\VisualStudioToolsForApplications\Tools\ProxyGen\x86\ProxyGen.exe"

set ProxyClass="$(SolutionDir)$(TargetName)Proxy\Proxy.cs"

set objPath="$(ProjectDir)obj\$(ConfigurationName)\$(TargetFileName)"

set proxyPath="$(SolutionDir)$(TargetName)Proxy\$(TargetName)OM.xml"

 

%proxygen% /l:%objPath% /c:%ProxyClass% /o:%proxyPath% /f

%proxygen% /l:%objPath% /c:%ProxyClass% /i:%proxyPath% /f

 

  1. Open Project Properties for project ShapeAppCSharpProxy
  2. Sign the assembly with a new key named “key” (remember to uncheck the “Protect my key file with a password” checkbox)
  3. Paste the following text into the “Post-build event command-line” box on the “Build Events” tab:

"%ProgramFiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i $(TargetPath)

  1. Right click the solution and click “Rebuild Solution”.
  2. Right-click the ShapeAppCSharpProxy project, click “Add Existing Item…” and add the newly created Proxy.cs and ShapeAppCSharpOM.xml files to the project.
  3. Right click the solution and click “Rebuild Solution” (to ensure everything is forced to rebuild anew.)
  4. Check %windir%\assembly for the ShapeAppCSharpProxy assembly.
  5. Create a .reg file with the following content:

 

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTAHostConfig]

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTAHostConfig\ShapeAppCSharp]

"AppName"="ShapeAppCSharp"

"ProjectTemplatesLocation"="C:\\Program Files\\Microsoft\\ShapeAppCSharp\\\\ProjectTemplates"

"VSCSProjectTemplatesLocation"="C:\\Program Files\\Microsoft\\ShapeAppCSharp\\\\ProjectTemplates\\CSharp"

"VSVBProjectTemplatesLocation"="C:\\Program Files\\Microsoft\\ShapeAppCSharp\\\\ProjectTemplates\\VisualBasic"

 

  1. Run the new .reg script
  2. Navigate to D:\Program Files\Visual Studio 2005 Tools for Applications SDK\2007.02\VisualStudioToolsForApplications\Tools\ProjectGen\x86\ and run ProjectGen.exe
  3. Select ShapeAppCSharp from the dropdown at the bottom and fill every other box with “ShapeAppCSharp” (with the exception of the icon field, which we will leave blank).  Click “Next”.
  4. On the next page, Click the “…” button and navigate to the C:\ShapeAppSamples\ShapeAppCSharp\ShapeAppCSharpProxy\bin\Debug directory and select ShapeAppCSharpProxy.dll
  5. Sigh with remorse at the message you see, as you have now followed the directions in the MSDN articles verbatim, but to no avail.

 

Am I missing anything?


The installer for ShapeAppAdvancedCSharp works fine, so for the time being I can still get a feel for how the thing works, but I'd like to step through the whole process myself to get a feel for how the migration process would be for one of my own applications.


(if the link at the top doesn't work, the SDK is at http://www.microsoft.com/downloads/details.aspx?FamilyId=7C2EA8AE-E051-449A-9051-3A351BF27B7F&displaylang=en )