From b981e800dbf9409298a561710b6649c477ee704c Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Tue, 11 Apr 2017 15:19:10 -0700 Subject: [PATCH 1/4] Add ItemTemplates for Razor Pages --- .../.template.config/dotnetcli.host.json | 2 ++ .../RazorPage/.template.config/template.json | 36 +++++++++++++++++++ .../content/RazorPage/Index.cs | 16 +++++++++ .../content/RazorPage/Index.cshtml | 6 ++++ 4 files changed, 60 insertions(+) create mode 100644 template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/dotnetcli.host.json create mode 100644 template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json create mode 100644 template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cs create mode 100644 template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/dotnetcli.host.json b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/dotnetcli.host.json new file mode 100644 index 00000000000..2c63c085104 --- /dev/null +++ b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/dotnetcli.host.json @@ -0,0 +1,2 @@ +{ +} diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json new file mode 100644 index 00000000000..1c737e799c3 --- /dev/null +++ b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json @@ -0,0 +1,36 @@ +{ + "author": "Microsoft", + "classifications": ["Web", "ASP.NET"], + "name": "Razor Page", + "generatorVersions": "[1.0.0.0-*)", + "groupIdentity": "Microsoft.AspNetCore.Mvc.RazorPage", + "precedence": "100", + "identity": "Microsoft.AspNetCore.Mvc.RazorPage", + "shortName": "page", + "sourceName": "Index", + "primaryOutputs": [ { "path": "Index.cshtml"}, { "path": "Index.cs" } ], + "defaultName": "Index", + "sources": { + "modifiers": [ + { + "condition": "(no-pagemodel)", + "exclude": [ + "Index.cs" + ] + } + ] + }, + "symbols": { + "namespace": { + "description": "namespace for the generated code", + "replaces": "MyApp.Namespace", + "type": "parameter" + }, + "no-pagemodel": { + "description": "create page without a PageModel", + "type": "parameter", + "datatype": "bool", + "defaultValue": "false" + } + } +} diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cs b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cs new file mode 100644 index 00000000000..7c4c883952b --- /dev/null +++ b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace MyApp.Namespace +{ + public class Index : PageModel + { + public void OnGet() + { + } + } +} \ No newline at end of file diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml new file mode 100644 index 00000000000..47911a87965 --- /dev/null +++ b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml @@ -0,0 +1,6 @@ +@page +@*#if (!no-pagemodel)*@ +@model Index +@*#endif*@ +@{ +} \ No newline at end of file From 5d8c65482cf40679c6b8a2dca7d47607f8e1e06c Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Wed, 12 Apr 2017 15:26:59 -0700 Subject: [PATCH 2/4] PR Feedback --- .../RazorPage/.template.config/template.json | 30 ++++++++++++------- .../content/RazorPage/Index.cshtml | 4 +-- .../RazorPage/{Index.cs => Index.cshtml.cs} | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) rename template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/{Index.cs => Index.cshtml.cs} (86%) diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json index 1c737e799c3..e94174ecba4 100644 --- a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json +++ b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json @@ -8,18 +8,26 @@ "identity": "Microsoft.AspNetCore.Mvc.RazorPage", "shortName": "page", "sourceName": "Index", - "primaryOutputs": [ { "path": "Index.cshtml"}, { "path": "Index.cs" } ], + "primaryOutputs": [ + { "path": "Index.cshtml"}, + { + "path": "Index.cshtml.cs", + "condition": "(!no-pagemodel)" + } + ], "defaultName": "Index", - "sources": { - "modifiers": [ - { - "condition": "(no-pagemodel)", - "exclude": [ - "Index.cs" - ] - } - ] - }, + "sources": [ + { + "modifiers": [ + { + "condition": "(no-pagemodel)", + "exclude": [ + "Index.cshtml.cs" + ] + } + ] + } + ], "symbols": { "namespace": { "description": "namespace for the generated code", diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml index 47911a87965..3fa062c0156 100644 --- a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml +++ b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml @@ -1,6 +1,6 @@ @page @*#if (!no-pagemodel)*@ -@model Index +@model IndexModel @*#endif*@ @{ -} \ No newline at end of file +} diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cs b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml.cs similarity index 86% rename from template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cs rename to template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml.cs index 7c4c883952b..44761afe84f 100644 --- a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cs +++ b/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml.cs @@ -7,7 +7,7 @@ namespace MyApp.Namespace { - public class Index : PageModel + public class IndexModel : PageModel { public void OnGet() { From 56c499c17ff2bc8c5a88bf108adee2a2cc66e77a Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Sat, 15 Apr 2017 09:10:12 -0700 Subject: [PATCH 3/4] Add web item templates project --- .../Templates.nuspec | 18 ++++++++++++++++ .../build.csproj | 21 +++++++++++++++++++ template_feed/Template.proj | 1 + 3 files changed, 40 insertions(+) create mode 100644 template_feed/Microsoft.DotNet.Web.ItemTemplates/Templates.nuspec create mode 100644 template_feed/Microsoft.DotNet.Web.ItemTemplates/build.csproj diff --git a/template_feed/Microsoft.DotNet.Web.ItemTemplates/Templates.nuspec b/template_feed/Microsoft.DotNet.Web.ItemTemplates/Templates.nuspec new file mode 100644 index 00000000000..56b24e1ad5c --- /dev/null +++ b/template_feed/Microsoft.DotNet.Web.ItemTemplates/Templates.nuspec @@ -0,0 +1,18 @@ + + + + Microsoft.DotNet.Web.ItemTemplates + $version$ + Microsoft + Web File Templates for Microsoft Template Engine + en-US + https://github.com/dotnet/templating + https://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm + + + + + + + + diff --git a/template_feed/Microsoft.DotNet.Web.ItemTemplates/build.csproj b/template_feed/Microsoft.DotNet.Web.ItemTemplates/build.csproj new file mode 100644 index 00000000000..b45c2bf4cb6 --- /dev/null +++ b/template_feed/Microsoft.DotNet.Web.ItemTemplates/build.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.0 + $(MSBuildThisFileDirectory)\Templates.nuspec + version=$(PackageVersion) + False + False + False + False + $(TemplatesFolder) + False + $(MSBuildThisFileDirectory)..\..\artifacts\scratch + + + + + + + + \ No newline at end of file diff --git a/template_feed/Template.proj b/template_feed/Template.proj index ea73bd9ded7..96c9bce7e6d 100644 --- a/template_feed/Template.proj +++ b/template_feed/Template.proj @@ -7,6 +7,7 @@ + From 0b2a60ca1adb6bec5c706da8bead714b2ee959bb Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Sat, 15 Apr 2017 09:13:56 -0700 Subject: [PATCH 4/4] Move Razor Pages item templates to web item templates --- .../content/RazorPage/.template.config/dotnetcli.host.json | 0 .../content/RazorPage/.template.config/template.json | 0 .../content/RazorPage/Index.cshtml | 0 .../content/RazorPage/Index.cshtml.cs | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename template_feed/{Microsoft.DotNet.Common.ItemTemplates => Microsoft.DotNet.Web.ItemTemplates}/content/RazorPage/.template.config/dotnetcli.host.json (100%) rename template_feed/{Microsoft.DotNet.Common.ItemTemplates => Microsoft.DotNet.Web.ItemTemplates}/content/RazorPage/.template.config/template.json (100%) rename template_feed/{Microsoft.DotNet.Common.ItemTemplates => Microsoft.DotNet.Web.ItemTemplates}/content/RazorPage/Index.cshtml (100%) rename template_feed/{Microsoft.DotNet.Common.ItemTemplates => Microsoft.DotNet.Web.ItemTemplates}/content/RazorPage/Index.cshtml.cs (100%) diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/dotnetcli.host.json b/template_feed/Microsoft.DotNet.Web.ItemTemplates/content/RazorPage/.template.config/dotnetcli.host.json similarity index 100% rename from template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/dotnetcli.host.json rename to template_feed/Microsoft.DotNet.Web.ItemTemplates/content/RazorPage/.template.config/dotnetcli.host.json diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json b/template_feed/Microsoft.DotNet.Web.ItemTemplates/content/RazorPage/.template.config/template.json similarity index 100% rename from template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/.template.config/template.json rename to template_feed/Microsoft.DotNet.Web.ItemTemplates/content/RazorPage/.template.config/template.json diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml b/template_feed/Microsoft.DotNet.Web.ItemTemplates/content/RazorPage/Index.cshtml similarity index 100% rename from template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml rename to template_feed/Microsoft.DotNet.Web.ItemTemplates/content/RazorPage/Index.cshtml diff --git a/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml.cs b/template_feed/Microsoft.DotNet.Web.ItemTemplates/content/RazorPage/Index.cshtml.cs similarity index 100% rename from template_feed/Microsoft.DotNet.Common.ItemTemplates/content/RazorPage/Index.cshtml.cs rename to template_feed/Microsoft.DotNet.Web.ItemTemplates/content/RazorPage/Index.cshtml.cs