Bug in ShapeAppCSharp Macro Project Generation

Last post 06-14-2007, 5:34 PM by Melody. 1 replies.
Sort Posts: Previous Next
  •  06-12-2007, 9:25 AM 476

    Bug in ShapeAppCSharp Macro Project Generation

    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:

    1. Build the setup project of the solution on a developer machine
    2. Install the .NET framework on the target machine
    3. Install MSXML6 on the target machine
    4. 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
    5. Install the German (1031) language pack of VSTA
    6. 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

    Filed under: , ,
  •  06-14-2007, 5:34 PM 484 in reply to 476

    Re: Bug in ShapeAppCSharp Macro Project Generation

    Michael,

                    I’m glad to hear you are taking an interest in VSTA.  Thank you for alerting us of the misplaced VB project in the zip file in the <applicationdir>\ProjectTemplates\CSharp\1003 directory.  Good catch, we’ll pass that onto Microsoft.

    As for the other issue with the AppAddIn.designer.cs not being added to the compilation file in the csproj file, I was sort of able to replicate the error on my machine (with VS and VSTA SDK installed).  The only way I found to produce a ShapeAppMacros.csproj file without the lines you added was to start the IDE without first recording a macro.  Building from the IDE also caused these lines to be added- so without removing the lines and attempting to build, I could not reproduce the error.  Once I had removed these lines, neither building in the IDE nor recording a macro would re-add them and I received the same errors. 

    I tried adding the lines to the ShapeAppCSharpAppAddInProject.csproj files (in the “%SystemDrive%\ShapeAppSamples\ShapeAppAdvancedCSharp\templates\CSharp\ShapeAppCSharp-AppLevel.zip” and “%SystemDrive%:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\CSharp\ShapeAppCSharp\1003\ShapeAppCSharp-AppLevel.zip” directories) but that did not cause the ShapeAppMacros.csproj to include the lines without recording or building from the IDE.

    If you record a macro, are lines added?  I will continue to look into this for you and try to get a fix to you as soon as possible.

    Thanks,

       -Melody

View as RSS news feed in XML