I'm trying to create a WebApi Project in a powershell script using DTE.
When I try to pass the folder name of the project template, I get the following error.
PS> $projTplPath = $dte.Solution.GetProjectTemplate("WebApiApplicationProjectTemplatev4.0", "CSharp")
Exception calling "GetProjectTemplate" with "2" argument(s): "The system cannot find the file specified. (Exception from HRESULT: 0x80070002)"
At line:1 char:1
+ $projTplPath = $dte.Solution.GetProjectTemplate("WebApiApplicationProjectTemplat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
If I try this same method with a different, more simple, project template name it works fine.
For example:
PS> $projTplPath = $dte.Solution.GetProjectTemplate("AjaxServerControl", "CSharp")
works no problem. So does creating a ClassLibrary, or ConsoleApplication.
What is the project template name for the WebApi project template? Better yet, were is the list of project template types? I can't seem to find an enum or other such listing on MSDN.