adding content files (non dotnet (js/css(sass/less)/img)) to a project via new-item

Jan 9, 2014 at 7:01 PM
Edited Jan 9, 2014 at 9:16 PM
This may be a simple oversight on my part, but I'm having a hard time adding a js file to a solution. The new-item cmdlet in this instance seems to require the parameters type and/or language, and I don't know what to specify, nor how to list the available acceptable values ("get-help new-item -parameter language|type" was at a failing point).

I tried the following:
new-item dte:\solution\projects\MyProject "Scripts\foo.js" -type script -language javascript

New-Item : The language specified is not supported by any of the installed packages.
At line:1 char:9
+ new-item <<<<  dte:\solution\projects\MyProject -name "Scripts\foo.js" -type script -language javascript
    + CategoryInfo          : NotSpecified: (solution\projec...pts\foo.js:String) [New-Item], FileNotFoundException
    + FullyQualifiedErrorId : NewItem.Invoke,Microsoft.PowerShell.Commands.NewItemCommand
 
new-item dte:\solution\projects\MyProjects -name "Scripts\foo.js" -type file -language jscript

New-Item : The language specified is not supported by any of the installed packages.
At line:1 char:9
+ new-item <<<<  dte:\solution\projects\MyProject -name "Scripts\foo.js" -type script -language jscript
    + CategoryInfo          : NotSpecified: (solution\projec...pts\foo.js:String) [New-Item], FileNotFoundException
    + FullyQualifiedErrorId : NewItem.Invoke,Microsoft.PowerShell.Commands.NewItemCommand
 
If I could even see what values are acceptable to provide, that would be tremendous. Also, as an aside, how would I go about adding a new item w/o pushing it into the editor?

Thanks!

Tony

Update: So the DTE provider does give some insights (ls -path dte:\templates\projectitems), but does this apply to language, type or both?

2nd Update: So after some trial and error I think I figured it out for js files, but does this apply to other types (css, less, img, txt)?

Great tool, BTW!
Coordinator
Jan 29, 2014 at 5:06 PM
Yeah, so this is a fairly dark art. To be honest, it's not well documented and I have a hard time figuring it out myself.

I did manage to find that item templates are stored on-disk and organized by language and type - that's where the dte:\templates hive is populated from. However, there is still no clear path of mapping those file/dir names onto the API backing the project item template.