How to automate the process of creating new project in Visual Studio? RRS feed

  • Question

  • User992810919 posted

    I have a Web API project which have some classes for exception handling, response formats and other handlers. Also, I have reference to 2 class libraries(Business and DAL layer).

    I create this solution repeatedly for different projects. How can I automate this process to create the solution which have a Web API project with some classes, 2 class libraries.

    I did some research and saw I can create project templates. But I did not find good article for my task.

    If anyone can help me with some direction towards solving it.

        Type type = Type.GetTypeFromProgID("VisualStudio.DTE.11.0");
        var visualStudio = Activator.CreateInstance(type, true);
        var dte = visualStudio.Instance;
        var solution = (Solution2)dte.Solution;
        solution.Create(destinationFolder, solutionName);
        string templateFile = solution.GetProjectTemplate(applicationProjectTemplateName);
        var project = solution.AddProjectFromTemplate(projectName, DestinationFolder, templateFile);

    I found above code which I can use but I dont understand

    Solution2, and "applicationProjectTemplateName" parameter value in following:

    Thursday, June 1, 2017 9:02 AM

All replies