Skip to content

Commit 522b1f9

Browse files
committed
adding template analyzer info to readme
1 parent 878cdf3 commit 522b1f9

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,52 @@ To get started creating templates, take a look at the following resources.
1818
- [Custom templates for dotnet new
1919
](https://docs.microsoft.com/en-us/dotnet/core/tools/custom-templates)
2020

21+
## Template analyzer
22+
23+
Sayed is working in his free time to create a tool that can be used to analyze .NET Core templates. You can install the analyzer with the command.
24+
25+
```bash
26+
> dotnet tool install --global sayedha.template.command
27+
```
28+
29+
For usage info run `templates -h`.
30+
31+
After installing the tool you can invoke it by running `templates` in the command line. You can analyze templates that are stored in a local folder
32+
with the `-f` parameter. You can also analyze templates that are contained in a NuGet package (.nupkg) file with the `-p` switch.
33+
34+
For example to analyze a folder you would run.
35+
36+
```bash
37+
> templates -f <path-to-folder>
38+
```
39+
40+
When you pass in a path, the tool will search the sub-folders to discover templates. If you are building several templates, you can pass
41+
in a parent folder that contains all the templates, and each template that is discovered will be analyzed.
42+
43+
### What the tool looks for
44+
45+
Error if missing a required property
46+
- `$.author`,
47+
- `$.sourceName`,
48+
- `$.classifications`,
49+
- `$.identity`,
50+
- `$.name`,
51+
- `$.shortName`,
52+
- `$.tags`,
53+
- `$.tags.language`,
54+
- `$.tags.type`
55+
56+
Warnings for missing recommended properties
57+
- `$.defaultName`,
58+
- `$.description`,
59+
- `$.symbols`,
60+
- `$.symbols.Framework`,
61+
- `$.symbols.Framework.choices`
62+
63+
Error if `$.tags.type` is not set to either project or item
64+
Warning if `$.symbols.Framework.type` is not set to parameter.
65+
Warning if `$.symbols.Framework.datatype` is not set to choice.
66+
2167
## How to enable cli templates in Visual Studio and Visual Studio for Mac
2268

2369
The feature to show templates that are installed using the command-line interface (cli) is a preview feature. This feature is disabled by default.

build-nuget.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Clean
3333
$outputpath = Join-Path $scriptDir nupkg
3434
$pathtonuspec = Join-Path $srcDir SayedHa.Template.NetCoreTool.nuspec
3535
if(Test-Path $pathtonuspec){
36-
nuget pack $pathtonuspec -OutputDirectory $outputpath
36+
nuget.exe pack $pathtonuspec -OutputDirectory $outputpath
3737
}
3838
else{
3939
'ERROR: nuspec file not found at {0}' -f $pathtonuspec | Write-Error
@@ -46,4 +46,7 @@ if(test-path $pathtonupkg){
4646
Reset-Templates
4747
'installing template with command "dotnet new --install {0}"' -f $pathtonupkg | write-host
4848
&dotnet new --install $pathtonupkg
49+
}
50+
else{
51+
'Not installing template because it was not found at "{0}"' -f $pathtonupkg | Write-Error
4952
}

0 commit comments

Comments
 (0)