受欢迎的博客标签

Error RZ3007: Targeted tag name cannot be null or whitespace in Asp .Net core 2.1

Published

Error: Microsoft.AspNetCore.Mvc.Razor.Compilation.Compilation Failed Exception: One or more compilation failures occurred:(0,0): Error RZ3007: Targeted tag name cannot be null or whitespace.   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath)

slove it:

Step 1: Disable precompile  updating below property in csproj file: 

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>

    <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>

  </PropertyGroup>
   ...

Step2: clear cache  This method worked for me: delete obj and bin folders

run 

dotnet restore

run 

dotnet build  

other: It looks as if your project references are incorrect. You can reproduce what I'm seeing by doing the following: At the command line run dotnet nuget locals all -c At the command line run dotnet restore At the command line run dotnet build This will get you into a clean state where any customized VS feeds or local feeds shouldn't impact you..