I am creating a Visual Studio Add-inn, i need to add new c# windows form using envDTE. any one can help?
Asked
Active
Viewed 375 times
1 Answers
1
If you are in an add-in that was created from a template, then you should have the application object that was passed in. In your onExecute, you can do this to add a form:
string templateItem = ((Solution2)_applicationObject.Solution).GetProjectItemTemplate("Windows Form", "CSharp");
_applicationObject.Solution.Projects.Item(1).ProjectItems.AddFromTemplate(templateItem, "MyForm.cs");

John Koerner
- 37,428
- 8
- 84
- 134