Hi,
we are currently evaluating VSTA and working with the ShapeAppCSharp advanced sample. One of our test was to install the sample on a clean XP Pro SP2 German machine with these easy steps:
- Build the setup project of the solution on a developer machine
- Install the .NET framework on the target machine
- Install MSXML6 on the target machine
- Install VSTA on the target machine with
msiexec /i vsta_aide.msi HOST=ShapeAppCSharp
We deliberately omitted VSTAINVS=1 because there is no VS on the target machine
- Install the German (1031) language pack of VSTA
- Install the ShapeAppCSharp Sample
One minor bug of the sample is that the ShapeAppCSharp-DocLeve.zip template installed in <applicationdir>\ProjectTemplates\CSharp\1033 actually contains the VB template doc-level template and not the C# template as intented. That's a minor bug of the ShapeAppAdvancedCSharpSetup project and you might want to correct it there.
Our real problem is with the macro project generated by the sample host.
If you start the VSTA IDE and create a new application level add-in, it will compile and gracefully integrate into the sample application.
But if you call the IDE from within the application, you will run into troubles. ShapeApp generates the ShapeAppMacros project which contains AppAddIn.cs along with two other files: AppAddIn.designer.cs (with the partial class inheriting from the Application proxy class) and AppAddIn.designer.xml. The problem is that the code behind file AppAddIn.designer.cs is not added to the compilation file list in the csproj file. Consequently, this results in two build errors of the macro project, if you just try to build it after opening:
Error 1 'ShapeAppMacros.csproj.AppAddIn' does not contain a definition for 'Startup' C:\Dokumente und Einstellungen\Michael Fischer\Eigene Dateien\ShapeAppCSharp\Macros\AppAddIn.cs 25 18 ShapeAppMacros
Error 2 'ShapeAppMacros.csproj.AppAddIn' does not contain a definition for 'Shutdown' C:\Dokumente und Einstellungen\Michael Fischer\Eigene Dateien\ShapeAppCSharp\Macros\AppAddIn.cs 26 18 ShapeAppMacros
I modified ShapeAppMacros.csproj and added the bold lines:
<ItemGroup>
<Compile Include="AppAddIn.designer.cs">
<DependentUpon>AppAddIn.designer.xml</DependentUpon>
</Compile>
...
</ItemGroup>
Now everything works as expected. This only happened on our clean target machine and was not reproducible on a developer machine with VS and the VSTA SDK installed. I can fix it but our users wouldn't be able to.
I'm sure the problem must be somewhere in AIMExtension.CreateNewMacroProject() which copies the macro project from the ShapeAppCSharp-AppLevel.zip template. And as a matter of fact, the ShapeAppCSharpAppAddInProject.csproj in there actually doesn't contain the compile tag for the AppAdddIn.designer.cs file! But, as I already mentioned, when you use that same template for a new project from the standalone VSTA IDE, the IDE fixes it and adds the missing compile tag to the project file.
It looks like a bug either in the VSTA DTE runtime or in CreateNewMacroProject() to me. Anyway, I'm stuck.
Any help gladly appreciated,
Michael