IDTWizard and managed C++

As per usual, C++ seems to be the ugly sister of the .NET languages. I have seen lots of examples of how to create a non-HTML-jscript wizards in VB and C# by creating a class based on the interface EnvDTE::IDTWizard. The simple walkthroughs just mention to check the COM interoperability flag (or something like that) and make your .vsz file. Done. Simple. I'm trying to do this simple task in managed C++ since I want a forms-based wizard but I am having no luck.

Here's what I understand I need to do:

1. Create a class derived from IDTWizard
namespace MyNameSpace {
public ref class Class1 : public EnvDTE::IDTWizard ...
}

2. Override the Execute method

public:
virtual void Execute( Object^ Application,
int hwndOwner,
cli::array<Object^>^% ContextParams,
cli::array<Object^>^% CustomParams,
wizardResult% retval );

3. Make a .vsz file, optional .vsdir file, optional .ico file
VSWizard 7.0
Wizard=MyNameSpace.Class1

I have seen it mentioned that VSWizard MUST be 8.0 but that doesn't seem to be the case.

4. Should work now right

Something is missing however. Anyone else got this to work

I have also tried setting [assembly:ComVisible(true)]; in my AssemblyInfo.cpp followed by
regasm /tlb MyWizard.dll.  This gave me the response:
"The operation could not be completed.  The system cannot find the file specified."
when I tried to launch the wizard from the File/New Project dialog.  I'm not sure what file is missing as I tried putting the DLL in a directory in my PATH as well as in the VS vcprojects folder (where the .vsz etc are).

Much thanks in advance,
Michael

P.S. I'm using VS 2005


Answer this question

IDTWizard and managed C++

  • under_way

    That was the missing piece! I added the /codebase switch and now I have the class being called.

    Big thanks Craig!


  • Allan Stirrett

    Even making this harder is that we incorrectly copied the C++/.NET sample when creating our automation samples. The sample that is within the samples MSI is the standard class library code with no Extensibility related code. We are looking to make an update to the samples, and will fix that.

    But for your problem, you should try using the /codebase switch when running regasm. Without this, the location of the assembly is not added to the registry, so the .NET Framework will only look in the GAC and directory containing the host application (in this case, devenv.exe).

    Craig



  • IDTWizard and managed C++