public CreateProjectFromTemplate ( string projectName, string templateName, string language, bool exclusive ) : void | ||
projectName | string | Name of new project. |
templateName | string | Name of project template to use |
language | string | language |
exclusive | bool | |
Résultat | void |
public void VBWinformsApplication() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { //Solution and project creation parameters var solutionName = "VBWinApp"; var projectName = "VBWinApp"; //Template parameters var language = "VisualBasic"; var projectTemplateName = "WindowsApplication.Zip"; var itemTemplateName = "CodeFile.zip"; var newFileName = "Test.vb"; var dte = (DTE) VsIdeTestHostContext.ServiceProvider.GetService(typeof (DTE)); var testUtils = new TestUtils(); testUtils.CreateEmptySolution(TestContext.TestDir, solutionName); Assert.AreEqual<int>(0, testUtils.ProjectCount()); //Add new Windows application project to existing solution testUtils.CreateProjectFromTemplate(projectName, projectTemplateName, language, false); //Verify that the new project has been added to the solution Assert.AreEqual<int>(1, testUtils.ProjectCount()); //Get the project var project = dte.Solution.Item(1); Assert.IsNotNull(project); Assert.IsTrue(string.Compare(project.Name, projectName, StringComparison.InvariantCultureIgnoreCase) == 0); //Verify Adding new code file to project var newCodeFileItem = testUtils.AddNewItemFromVsTemplate(project.ProjectItems, itemTemplateName, language, newFileName); Assert.IsNotNull(newCodeFileItem, "Could not create new project item"); }); }