views:

135

answers:

0

I'm writing an IWizard Item Template, which will be adding code to a Form.Designer.cs file that already exists in the project, but I can't find a way to force new code to write to that file, rather than Form.cs.

How do you specify which partial class to write code to in the CodeModel and other DTE classes?

Project project = dte.Solution.Projects.Item(1);
CodeClass form = project.CodeModel.CodeTypeFromFullName("...Form") as CodeClass;

form.AddVariable( menuItemName,
                  "Full.Variable.ClassPath",
                  -1,
                  vsCMAccess.vsCMAccessPrivate,
                  @"/Path/To/Forms/Form.Designer.cs" );