Alex
Alex

Reputation: 910

Create project from vstemplate

I am trying to create project from the project template. I have implemented custom wizard for project template and on ProjectFinishedGenerating it runs:

try
{
    Solution2 solution = (Solution2)_envDte.Solution;
    var path = Path.Combine(solutionFoler, "Setup");
    // Get the project template
    var projectTemplateFileFullName = solution.GetProjectTemplate(projectTemplateName, language);
    var proj = solution.AddFromTemplate(projectTemplateFileFullName, path, projectName, false);  
}
catch (Exception ex)
{
    System.Windows.Forms.MessageBox.Show(ex.ToString());
}

AddFromTemplate returns null, and does not create new project. No exception occurred, as well. Please suggest me the way how to create solution from template.

Upvotes: 1

Views: 426

Answers (1)

Alex
Alex

Reputation: 910

I have resolved. The main problem is that you have to specify path to *.csproj file, not to *.vstemplate one.

Upvotes: 1

Related Questions