From 821fa1c48ccf0366a30b14eb5c0b955e2a5f0a61 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Fri, 24 Jun 2016 11:47:45 -0700 Subject: [PATCH] Update TagHelpers intro doc and sample (#1491) * Update TagHelpers doc and sample * Reverted some changes --- .../Views/_ViewStart.cshtml | 2 +- .../src/AuthoringTagHelpers/project.json | 45 +++++++++---------- aspnet/mvc/views/tag-helpers/intro.rst | 10 +++-- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/aspnet/mvc/views/tag-helpers/authoring/sample/AuthoringTagHelpers/src/AuthoringTagHelpers/Views/_ViewStart.cshtml b/aspnet/mvc/views/tag-helpers/authoring/sample/AuthoringTagHelpers/src/AuthoringTagHelpers/Views/_ViewStart.cshtml index a5f10045db..be2a4f37a6 100644 --- a/aspnet/mvc/views/tag-helpers/authoring/sample/AuthoringTagHelpers/src/AuthoringTagHelpers/Views/_ViewStart.cshtml +++ b/aspnet/mvc/views/tag-helpers/authoring/sample/AuthoringTagHelpers/src/AuthoringTagHelpers/Views/_ViewStart.cshtml @@ -1,3 +1,3 @@ @{ - Layout = "_Layout"; + Layout = null; } diff --git a/aspnet/mvc/views/tag-helpers/authoring/sample/AuthoringTagHelpers/src/AuthoringTagHelpers/project.json b/aspnet/mvc/views/tag-helpers/authoring/sample/AuthoringTagHelpers/src/AuthoringTagHelpers/project.json index 8c0e72cac2..ba43663496 100644 --- a/aspnet/mvc/views/tag-helpers/authoring/sample/AuthoringTagHelpers/src/AuthoringTagHelpers/project.json +++ b/aspnet/mvc/views/tag-helpers/authoring/sample/AuthoringTagHelpers/src/AuthoringTagHelpers/project.json @@ -1,42 +1,36 @@ { "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0-rc2-3002702", + "version": "1.0.0", "type": "platform" }, - "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final", - "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final", + "Microsoft.AspNetCore.Diagnostics": "1.0.0", + "Microsoft.AspNetCore.Mvc": "1.0.0", "Microsoft.AspNetCore.Razor.Tools": { - "version": "1.0.0-preview1-final", + "version": "1.0.0-preview2-final", "type": "build" }, - "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final", - "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final", - "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final", - "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final", - "Microsoft.Extensions.Logging": "1.0.0-rc2-final", - "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final", - "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final", - "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final" + "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", + "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", + "Microsoft.AspNetCore.StaticFiles": "1.0.0", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", + "Microsoft.Extensions.Configuration.Json": "1.0.0", + "Microsoft.Extensions.Logging": "1.0.0", + "Microsoft.Extensions.Logging.Console": "1.0.0", + "Microsoft.Extensions.Logging.Debug": "1.0.0", + "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", + "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0" }, "tools": { - "Microsoft.AspNetCore.Razor.Tools": { - "version": "1.0.0-preview1-final", - "imports": "portable-net45+win8+dnxcore50" - }, - "Microsoft.AspNetCore.Server.IISIntegration.Tools": { - "version": "1.0.0-preview1-final", - "imports": "portable-net45+win8+dnxcore50" - } + "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", + "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" }, "frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", - "dnxcore50", "portable-net45+win8" ] } @@ -48,20 +42,23 @@ }, "runtimeOptions": { - "gcServer": true + "configProperties": { + "System.GC.Server": true + } }, "publishOptions": { "include": [ "wwwroot", "Views", + "Areas/**/Views", "appsettings.json", "web.config" ] }, "scripts": { - "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ], + "prepublish": [ "bower install" ], "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] } } diff --git a/aspnet/mvc/views/tag-helpers/intro.rst b/aspnet/mvc/views/tag-helpers/intro.rst index 53862438dc..16428f2cfe 100644 --- a/aspnet/mvc/views/tag-helpers/intro.rst +++ b/aspnet/mvc/views/tag-helpers/intro.rst @@ -74,10 +74,12 @@ If your project contains an ``EmailTagHelper`` with the default namespace (``Aut .. FQN syntax -.. literalinclude:: authoring/sample/AuthoringTagHelpers/src/AuthoringTagHelpers/Views/_ViewImports.cshtml - :language: html - :lines: 1-3 +.. code-block:: html :emphasize-lines: 3 + + @using AuthoringTagHelpers + @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers + @addTagHelper "AuthoringTagHelpers.TagHelpers.EmailTagHelper, AuthoringTagHelpers" To add a Tag Helper to a view using an FQN, you first add the FQN (``AuthoringTagHelpers.TagHelpers.EmailTagHelper``), and then the assembly name (*AuthoringTagHelpers*). Most developers prefer to use the "\*" wildcard syntax. The wildcard syntax allows you to insert the wildcard character "\*" as the suffix in an FQN. For example, any of the following directives will bring in the ``EmailTagHelper``: @@ -126,7 +128,7 @@ The same hierarchy rules that apply to ``@addTagHelper`` also apply to ``@tagHel IntelliSense support for Tag Helpers ---------------------------------------- -When you create a new ASP.NET web app in Visual Studio, it adds "Microsoft.AspNetCore.Tooling.Razor" to the *project.json* file. This is the package that adds Tag Helper tooling. +When you create a new ASP.NET web app in Visual Studio, it adds "Microsoft.AspNetCore.Razor.Tools" to the *project.json* file. This is the package that adds Tag Helper tooling. Consider writing an HTML ``