locked
What are the correct arguments for Solution.GetProjectTemplate() to get the VS2013 'ASP.NET Web Application' Project Template? RRS feed

  • Question

  • I want to add a web project to my solution using the 'ASP.NET Web Application' project template.  Through trial and error I found the right project template in my VS 2013 folder, under "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ProjectTemplates\CSharp\Web\1033\WebTemplate45".  If I skip the call to GetProjectTemplate() and call AddFromTemplate() passing the full path to the vstemplate file, the project gets created as I'd expect, but I'd like to avoid hard-coding the full path to the template and use GetProjectTemplate to resolve the full path.  I've tried every combination of arguments that make sense but I always get a FileNotFound exception.

    What arguments should I be passing to GetProjectTemplate()?  Thanks.

    Tuesday, May 13, 2014 11:15 AM

Answers

  • Hi,

    According to your description, you want to know how to use GetProjectTemplate(). Please refer to the document below. It includes the examples and code sample.

    Solution2.GetProjectTemplate Method

    Returns a path to the indicated project template.

    If a template has a RequiredFrameworkVersion element higher than 4.0, you should provide the version in the call so that the search for the template will find a match. For example, instead of calling GetProjectTemplate("Extensibility\\1033\\VSIXProject.zip", "CSharp"); call GetProjectTemplate("Extensibility\\1033\\VSIXProject.zip|FrameworkVersion=4.5", "CSharp");.

    Let me know if it help or anything else I can provide.

    Best regards,

    • Marked as answer by Anna Cc Tuesday, May 20, 2014 7:41 AM
    Wednesday, May 14, 2014 10:12 AM