diff options
author | Javier Calvarro Nelson <jacalvar@microsoft.com> | 2019-02-12 17:08:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-12 17:08:11 +0300 |
commit | 6827bb74436760aa3bb20934a1a1da4933062acb (patch) | |
tree | 00bf80ae3b22bc046c89dd2d7116070edadfb662 /src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp | |
parent | c1bc210e8ebb6402ac74f4705d5748bc8e3ee544 (diff) |
[Templating] Razor class library for components (#7461)
* [Components] Razor class library for components
* Updates the Razor Class Library to be a portable components library by
default.
* Adds an option to support the old RCL that includes support for Views
and pages.
* Usage:
* `dotnet new razorclasslib` produces the same traditional Razor Class Library.
* `dotnet new razorclasslib -s false` produces a Razor Class Library without views and pages support.
Diffstat (limited to 'src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp')
2 files changed, 20 insertions, 0 deletions
diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp/.template.config/dotnetcli.host.json b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp/.template.config/dotnetcli.host.json index 709f1b9629..c658c087dd 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp/.template.config/dotnetcli.host.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp/.template.config/dotnetcli.host.json @@ -8,6 +8,10 @@ "skipRestore": { "longName": "no-restore", "shortName": "" + }, + "SupportPagesAndViews": { + "longName": "support-pages-and-views", + "shortName": "s" } } } diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp/.template.config/template.json b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp/.template.config/template.json index 47000e198f..405e29cca7 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp/.template.config/template.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorClassLibrary-CSharp/.template.config/template.json @@ -20,6 +20,16 @@ }, "sourceName": "Company.RazorClassLibrary1", "preferNameDirectory": true, + "sources": [ + { + "modifiers": [{ + "condition": "(!SupportPagesAndViews)", + "exclude": [ + "Areas/**" + ] + }] + } + ], "symbols": { "Framework": { "type": "parameter", @@ -42,6 +52,12 @@ "datatype": "bool", "description": "If specified, skips the automatic restore of the project on create.", "defaultValue": "false" + }, + "SupportPagesAndViews": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "true", + "description": "Whether to support adding traditional Razor pages and Views in addition to components to this library." } }, "primaryOutputs": [ |