Fill in SDK gaps (#16690)

* Fill in SDK gaps

* Apply suggestions from code review

Co-Authored-By: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>

* Update web-sdk.md (#16703)

* Update web-sdk.md

* Update web-sdk.md

Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
pull/16707/head
Pranav K 2020-01-24 19:16:40 -08:00 committed by Rick Anderson
parent e2b2df189f
commit 45035fcab2
4 changed files with 68 additions and 20 deletions

View File

@ -153,11 +153,11 @@ To enable runtime compilation based on the environment and configuration mode:
```csharp
public IWebHostEnvironment Env { get; set; }
public void ConfigureServices(IServiceCollection services)
{
IMvcBuilder builder = services.AddRazorPages();
#if DEBUG
if (Env.IsDevelopment())
{

View File

@ -63,16 +63,16 @@ To use the Razor SDK to build class libraries containing Razor views or Razor Pa
* Typically, a package reference to `Microsoft.AspNetCore.Mvc` is required to receive additional dependencies that are required to build and compile Razor Pages and Razor views. At a minimum, your project should add package references to:
* `Microsoft.AspNetCore.Razor.Design`
* `Microsoft.AspNetCore.Razor.Design`
* `Microsoft.AspNetCore.Mvc.Razor.Extensions`
* `Microsoft.AspNetCore.Mvc.Razor`
The `Microsoft.AspNetCore.Razor.Design` package provides the Razor compilation tasks and targets for the project.
The preceding packages are included in `Microsoft.AspNetCore.Mvc`. The following markup shows a project file that uses the Razor SDK to build Razor files for an ASP.NET Core Razor Pages app:
[!code-xml[](sdk/sample/RazorSDK.csproj)]
::: moniker-end
::: moniker range="= aspnetcore-2.1"
@ -108,7 +108,7 @@ The properties and items in the following table are used to configure inputs and
| Property | Description |
| -------- | ----------- |
| `RazorTargetName` | File name (without extension) of the assembly produced by Razor. |
| `RazorTargetName` | File name (without extension) of the assembly produced by Razor. |
| `RazorOutputPath` | The Razor output directory. |
| `RazorCompileToolset` | Used to determine the toolset used to build the Razor assembly. Valid values are `Implicit`, `RazorSDK`, and `PrecompilationTool`. |
| [EnableDefaultContentItems](https://github.com/aspnet/websdk/blob/rel-2.0.0/src/ProjectSystem/Microsoft.NET.Sdk.Web.ProjectSystem.Targets/netstandard1.0/Microsoft.NET.Sdk.Web.ProjectSystem.targets#L21) | Default is `true`. When `true`, includes *web.config*, *.json*, and *.cshtml* files as content in the project. When referenced via `Microsoft.NET.Sdk.Web`, files under *wwwroot* and config files are also included. |
@ -121,6 +121,10 @@ The properties and items in the following table are used to configure inputs and
| `EmbedRazorGenerateSources` | When `true`, adds RazorGenerate (*.cshtml*) items as embedded files to the generated Razor assembly. Defaults to `false`. |
| `UseRazorBuildServer` | When `true`, uses a persistent build server process to offload code generation work. Defaults to the value of `UseSharedCompilation`. |
| `GenerateMvcApplicationPartsAssemblyAttributes` | When `true`, the SDK generates additional attributes used by MVC at runtime to perform application part discovery. |
| `DefaultWebContentItemExcludes` | A globbing pattern for item elements that are to be excluded from the `Content` item group in projects targeting the Web or Razor SDK |
| `ExcludeConfigFilesFromBuildOutput` | When `true`, *.config* and *.json* files do not get copied to the build output directory. |
| `AddRazorSupportForMvc` | When `true`, configures the Razor SDK to add support for the MVC configuration that is required when building applications containing MVC views or Razor Pages. This property is implicitly set for .NET Core 3.0 or later projects targeting the Web SDK |
| `RazorLangVersion` | The version of the Razor Language to target. |
For more information on properties, see [MSBuild properties](/visualstudio/msbuild/msbuild-properties).

View File

@ -0,0 +1,42 @@
---
title: ASP.NET Core Web SDK
author: Rick-Anderson
description: Overview of Microsoft.NET.Sdk.Web.
ms.author: riande
ms.date: 2/27/2020
no-loc: [Blazor]
uid: razor-pages/web-sdk
---
# ASP.NET Core Web SDK
### Overview
`Microsoft.NET.Sdk.Web` is a [MSBuild project SDK](https://docs.microsoft.com/visualstudio/msbuild/how-to-use-project-sdk) for building ASP.NET Core apps. It's possible to build an ASP.NET Core app without this SDK, however, the Web SDK is:
* Tailored towards providing a first-class experience.
* The recommended target for most users.
Use the Web.SDK in a project:
```xml
<Project SDK="Microsoft.NET.Sdk.Web">
<!-- omitted for brevity -->
</Project>
```
Features enabled by using the Web SDK:
* Projects targeting .NET Core 3.0 or later implicitly reference:
* The [ASP.NET Core shared framework](xref:fundamentals/metapackage-app).
* [Analyzers](xref:https://docs.microsoft.com/visualstudio/extensibility/getting-started-with-roslyn-analyzers) designed for building ASP.NET Core apps.
* The WebSDK enables MSBuild targets that enables the use of publish profiles, and publishing using WebDeploy.
### Properties
| Property | Description |
| -------- | ----------- |
| `DisableImplicitFrameworkReferences` | Disables implicit reference to the `Microsoft.AspNetCore.App` shared framework. |
| `DisableImplicitAspNetCoreAnalyzers` | Disables implicit reference to ASP.NET Core analyzers. |
| `DisableImplicitComponentsAnalyzers` | Disables implicit reference to Razor Components analyzers when building Blazor (server) applications. |

View File

@ -230,8 +230,6 @@
uid: razor-pages/filter
- name: Route and app conventions
uid: razor-pages/razor-pages-conventions
- name: Razor SDK
uid: razor-pages/sdk
- name: MVC
items:
- name: Overview
@ -409,21 +407,25 @@
href: mvc/views/working-with-forms.md#the-validation-summary-tag-helper
- name: Advanced
items:
- name: Application parts
uid: mvc/extensibility/app-parts
- name: Application model
uid: mvc/controllers/application-model
- name: Areas
uid: mvc/controllers/areas
- name: Filters
uid: mvc/controllers/filters
- name: Razor SDK
uid: razor-pages/sdk
- name: View components
uid: mvc/views/view-components
- name: View compilation
uid: mvc/views/view-compilation
- name: App model
uid: mvc/controllers/application-model
- name: Filters
uid: mvc/controllers/filters
- name: Areas
uid: mvc/controllers/areas
- name: Upload files
uid: mvc/models/file-uploads
- name: App parts
uid: mvc/extensibility/app-parts
- name: aspnet-codegenerator
- name: Web SDK
uid: razor-pages/web-sdk
- name: aspnet-codegenerator (Scaffolding)
uid: fundamentals/tools/dotnet-aspnet-codegenerator
- name: Web API apps
items:
@ -561,7 +563,7 @@
- name: Hub protocol
href: https://github.com/aspnet/AspNetCore/blob/master/src/SignalR/docs/specs/HubProtocol.md
- name: Transport protocols
href: https://github.com/aspnet/AspNetCore/blob/master/src/SignalR/docs/specs/TransportProtocols.md
href: https://github.com/aspnet/AspNetCore/blob/master/src/SignalR/docs/specs/TransportProtocols.md
- name: Remote Procedure Call apps
items:
- name: Introduction to gRPC services
@ -1036,7 +1038,7 @@
- name: Enable Cross-Origin Requests (CORS)
uid: security/cors
- name: Share cookies among apps
uid: security/cookie-sharing
uid: security/cookie-sharing
- name: SameSite cookies
uid: security/samesite
- name: IP safelist