Added Razor class library project template

[Fixes #323] Add a Razor class library project template
This commit is contained in:
Kiran Challa 2018-04-10 09:04:49 -07:00
parent c3ac7629d1
commit f824751bb9
11 changed files with 162 additions and 3 deletions

View File

@ -48,6 +48,9 @@
<GeneratedContent Include="RazorPagesWeb-CSharp.csproj.in" OutputPath="content/RazorPagesWeb-CSharp/Company.WebApplication1.csproj">
<Properties>$(GeneratedContentProperties)</Properties>
</GeneratedContent>
<GeneratedContent Include="RazorClassLibrary-CSharp.csproj.in" OutputPath="content/RazorClassLibrary-CSharp/Company.RazorClassLibrary1.csproj">
<Properties>$(GeneratedContentProperties)</Properties>
</GeneratedContent>
<GeneratedContent Include="StarterWeb-CSharp.csproj.in" OutputPath="content/StarterWeb-CSharp/Company.WebApplication1.csproj">
<Properties>$(GeneratedContentProperties)</Properties>
</GeneratedContent>

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="${MicrosoftAspNetCoreMvcPackageVersion}" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,19 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"TargetFrameworkOverride": {
"isHidden": true,
"longName": "target-framework-override",
"shortName": ""
},
"Framework": {
"longName": "framework",
"isHidden": true
},
"skipRestore": {
"longName": "no-restore",
"shortName": ""
}
}
}
g

View File

@ -0,0 +1,78 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "Microsoft",
"classifications": ["Web", "Razor", "Library", "Razor Class Library"],
"name": "Razor Class Library",
"generatorVersions": "[1.0.0.0-*)",
"description": "A project for creating a Razor class library that targets .NET Standard",
"groupIdentity": "Microsoft.Web.Razor",
"precedence": "3000",
"identity": "Microsoft.Web.Razor.Library.CSharp.2.1",
"shortName": "razorclasslib",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "Company.RazorClassLibrary1",
"preferNameDirectory": true,
"symbols": {
"TargetFrameworkOverride": {
"type": "parameter",
"description": "Overrides the target framework",
"replaces": "TargetFrameworkOverride",
"datatype": "string",
"defaultValue": ""
},
"Framework": {
"type": "parameter",
"description": "The target framework for the project.",
"datatype": "choice",
"choices": [
{
"choice": "netcoreapp2.1",
"description": "Target netcoreapp2.1"
}
],
"defaultValue": "netcoreapp2.1"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
},
"skipRestore": {
"type": "parameter",
"datatype": "bool",
"description": "If specified, skips the automatic restore of the project on create.",
"defaultValue": "false"
}
},
"primaryOutputs": [
{ "path": "Company.RazorClassLibrary1.csproj" },
{
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
"path": "Areas/MyFeature/Pages/Page1.cshtml"
}
],
"defaultName": "RazorClassLibrary1",
"postActions": [
{
"condition": "(!skipRestore)",
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{ "text": "Run 'dotnet restore'" }
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
"description": "Opens Areas/MyFeature/Pages/Page1.cshtml in the editor",
"manualInstructions": [],
"actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
"args": {
"files": "1"
},
"continueOnError": true
}
]
}

View File

@ -0,0 +1,16 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "Razor Class Library",
"id": "1023",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}"
},
"description": {
"text": "A project template for creating a Razor class library.",
"id": "1024",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}"
},
"order": 305,
"icon": "vs-2017.3/Empty.png",
"learnMoreLink": "https://go.microsoft.com/fwlink/?linkid=872103"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

View File

@ -0,0 +1,16 @@
@page
@model Company.RazorClassLibrary1.MyFeature.Pages.Page1Model
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Page1</title>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Company.RazorClassLibrary1.MyFeature.Pages
{
public class Page1Model : PageModel
{
public void OnGet()
{
}
}
}

View File

@ -10,7 +10,7 @@
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1101"
},
"order": 301,
"order": 310,
"icon": "icon.png",
"learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
"uiFilters": [

View File

@ -10,7 +10,7 @@
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1501"
},
"order": 301,
"order": 315,
"icon": "icon.png",
"learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
"uiFilters": [

View File

@ -10,7 +10,7 @@
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1401"
},
"order": 301,
"order": 320,
"icon": "icon.png",
"learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
"uiFilters": [