parent
4a0359b06d
commit
404adf0a59
|
@ -903,10 +903,10 @@ Rendered output:
|
|||
|
||||
There are three directives that pertain to [Tag Helpers](xref:mvc/views/tag-helpers/intro).
|
||||
|
||||
| Directive | Function |
|
||||
| --------- | -------- |
|
||||
| [`@addTagHelper`](xref:mvc/views/tag-helpers/intro#add-helper-label) | Makes Tag Helpers available to a view. |
|
||||
| [`@removeTagHelper`](xref:mvc/views/tag-helpers/intro#remove-razor-directives-label) | Removes Tag Helpers previously added from a view. |
|
||||
| Directive | Function |
|
||||
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
|
||||
| [`@addTagHelper`](xref:mvc/views/tag-helpers/intro#add-helper-label) | Makes Tag Helpers available to a view. |
|
||||
| [`@removeTagHelper`](xref:mvc/views/tag-helpers/intro#remove-razor-directives-label) | Removes Tag Helpers previously added from a view. |
|
||||
| [`@tagHelperPrefix`](xref:mvc/views/tag-helpers/intro#prefix-razor-directives-label) | Specifies a tag prefix to enable Tag Helper support and to make Tag Helper usage explicit. |
|
||||
|
||||
## Razor reserved keywords
|
||||
|
@ -948,45 +948,13 @@ C# Razor keywords must be double-escaped with `@(@C# Razor Keyword)` (for exampl
|
|||
|
||||
## Inspect the Razor C# class generated for a view
|
||||
|
||||
The [Razor SDK](xref:razor-pages/sdk) handles compilation of Razor files. When building a project, the Razor SDK generates an `obj/<build_configuration>/<target_framework_moniker>/Razor` directory in the project root. The directory structure within the `Razor` directory mirrors the project's directory structure.
|
||||
|
||||
Consider the following directory structure in an ASP.NET Core Razor Pages project:
|
||||
|
||||
The [Razor SDK](xref:razor-pages/sdk) handles compilation of Razor files. By default, the generated code files are not emitted in recent versions of ASP.NET Core. To enable this, set the `EmitCompilerGeneratedFiles` directive in your `.csproj` file to `true`:
|
||||
```xml
|
||||
<PropertyGroup>
|
||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||
</PropertyGroup>
|
||||
```
|
||||
Areas/
|
||||
Admin/
|
||||
Pages/
|
||||
Index.cshtml
|
||||
Index.cshtml.cs
|
||||
Pages/
|
||||
Shared/
|
||||
_Layout.cshtml
|
||||
_ViewImports.cshtml
|
||||
_ViewStart.cshtml
|
||||
Index.cshtml
|
||||
Index.cshtml.cs
|
||||
```
|
||||
|
||||
Building the project in *Debug* configuration yields the following `obj` directory:
|
||||
|
||||
```
|
||||
obj/
|
||||
Debug/
|
||||
netcoreapp2.1/
|
||||
Razor/
|
||||
Areas/
|
||||
Admin/
|
||||
Pages/
|
||||
Index.g.cshtml.cs
|
||||
Pages/
|
||||
Shared/
|
||||
_Layout.g.cshtml.cs
|
||||
_ViewImports.g.cshtml.cs
|
||||
_ViewStart.g.cshtml.cs
|
||||
Index.g.cshtml.cs
|
||||
```
|
||||
|
||||
To view the generated class for `Pages/Index.cshtml`, open `obj/Debug/netcoreapp2.1/Razor/Pages/Index.g.cshtml.cs`.
|
||||
When building the project, the Razor SDK generates an `obj/<build_configuration>/net6.0/generated/` directory in the project root. Its subdirectory contains the emitted Razor page code files.
|
||||
|
||||
## View lookups and case sensitivity
|
||||
|
||||
|
|
Loading…
Reference in New Issue