New project wizard - porting from vs2003 to vs 2005

I created, using CodeDom, a new custom project type with VS2003.

The project creates a new form with a few components, several predefined methods etc.; just to be clear the project calls

dte.LaunchWizard("CSharpExe.vsz", ref parms)

I'm now trying to port this project to VS2005 and I had to modify the above call to :

Solution2 sol2 = (Solution2)ApplicationObject.Solution;

strTemplatePath = sol2.GetProjectTemplate("Windows Application","CSharp");

dte.LaunchWizard(strTemplatePath,ref parms);

No problems here.

The project still inserts all the component (declaration, initialization etc) following the VS2003 approach (i.e. everything in Form1.cs) while I would like to follow the new VS2005 approach putting declaration and Initialization in Form1.Designer.cs and methods in Form1.cs but I've been unable to do so.

Do you have any suggestion

TIA

Dario



Answer this question

New project wizard - porting from vs2003 to vs 2005

  • ARichter

    Unfortunately you cannot do this with VS 2003. To split the code between two files like this, the language needs to support partial classes - something that is not available in Visual Studio 2003. The best you could do is to create the second file with a class that has all the variables defined. Then in the Form1.cs file you have a class that inherits from the first class and then uses those variables.

    Craig



  • New project wizard - porting from vs2003 to vs 2005