title: Error RZ3007: Targeted tag name cannot be null or whitespace
body: <p>After upgrading to .NET Core 2.0 my 1.1 web application cannot run.  I get the error message indicated below.  After checking the output I found references to the RZ3007 error which I believe is related to the Razor compiler.  The View is not compiling.</p>
  
  <p>Home/Index.cshtml:</p>
  
  <pre><code>@model LayoutViewModel
  &lt;div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Views/Shared/_Layout.cshtml</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;
      &lt;title&gt;@ViewData["Title"] - GLCoderConfiguration&lt;/title&gt;
  
      &lt;environment names="Development"&gt;
          &lt;link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" /&gt;
          &lt;link rel="stylesheet" href="~/css/site.css?" /&gt;
      &lt;/environment&gt;
      &lt;environment names="Staging,Production"&gt;
          &lt;link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
                asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
                asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" /&gt;
          &lt;link rel="stylesheet" href="~/css/site.min.css?" asp-append-version="true" /&gt;
  
     &lt;/environment&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;nav class="navbar navbar-default navbar-form " &gt;
  
          &lt;div class="navbar-header" style="margin-top:10px;margin-bottom:15px;"&gt;
              &lt;button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"&gt;
                  &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
              &lt;/button&gt;
              &lt;a class="navbar-brand" href="#"&gt;SCM - NCMain&lt;/a&gt;
          &lt;/div&gt;
  
  
          &lt;div class="collapse navbar-collapse vcenter" id="bs-example-navbar-collapse-1" style="margin-top:10px;margin-bottom:0px;"&gt;
  
        &lt;/div&gt;
      &lt;/nav&gt;
      &lt;div class="container body-content"&gt;
          @RenderBody()
          &lt;hr /&gt;
          &lt;footer&gt;
              &lt;p&gt;&amp;copy; 2017 - England Logisitics - SCM&lt;/p&gt;
          &lt;/footer&gt;
      &lt;/div&gt;
  
      &lt;environment names="Development"&gt;
          &lt;script src="~/lib/jquery/dist/jquery.js"&gt;&lt;/script&gt;
          &lt;script src="~/lib/bootstrap/dist/js/bootstrap.js"&gt;&lt;/script&gt;
          &lt;script src="~/js/site.js" asp-append-version="true"&gt;&lt;/script&gt;
      &lt;/environment&gt;
      &lt;environment names="Staging,Production"&gt;
          &lt;script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
                  asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                  asp-fallback-test="window.jQuery"
                  crossorigin="anonymous"
                  integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk"&gt;
          &lt;/script&gt;
          &lt;script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
                  asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
                  asp-fallback-test="window.jQuery &amp;&amp; window.jQuery.fn &amp;&amp; window.jQuery.fn.modal"
                  crossorigin="anonymous"
                  integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"&gt;
          &lt;/script&gt;
          &lt;script src="~/js/site.min.js" asp-append-version="true"&gt;&lt;/script&gt;
  
  
      &lt;/environment&gt;
  
      @RenderSection("Scripts", required: false)
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I had a couple of view components (LoginStatus and MenuItems) but removed them to try to get this working.</p>
  
  <p>Output from run:</p>
  
  <pre><code>    Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: 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)
     at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CreateCacheEntry(String normalizedPath)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
     at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath)
     at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet`1 expirationTokens, String relativePath, Boolean isMainPage)
     at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.OnCacheMiss(ViewLocationExpanderContext expanderContext, ViewLocationCacheKey cacheKey)
     at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext actionContext, String pageName, Boolean isMainPage)
     at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
     at Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
     at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor.FindView(ActionContext actionContext, ViewResult viewResult)
     at Microsoft.AspNetCore.Mvc.ViewResult.&lt;ExecuteResultAsync&gt;d__26.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.&lt;InvokeResultAsync&gt;d__19.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.&lt;InvokeNextResultFilterAsync&gt;d__24.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
     at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
     at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.&lt;InvokeNextResourceFilter&gt;d__22.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
     at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
     at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.&lt;InvokeFilterPipelineAsync&gt;d__17.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.&lt;InvokeAsync&gt;d__15.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.AspNetCore.Builder.RouterMiddleware.&lt;Invoke&gt;d__4.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.AspNetCore.Session.SessionMiddleware.&lt;Invoke&gt;d__9.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at Microsoft.AspNetCore.Session.SessionMiddleware.&lt;Invoke&gt;d__9.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.&lt;Invoke&gt;d__6.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.&lt;Invoke&gt;d__7.MoveNext()
  </code></pre>
  
  <p>.CSProj</p>
  
  <pre><code>    &lt;Project Sdk="Microsoft.NET.Sdk.Web"&gt;
  
        &lt;PropertyGroup&gt;
          &lt;TargetFramework&gt;netcoreapp2.0&lt;/TargetFramework&gt;
          &lt;MvcRazorCompileOnPublish&gt;true&lt;/MvcRazorCompileOnPublish&gt;
          &lt;MvcCompileViews&gt;true&lt;/MvcCompileViews&gt;
          &lt;PreserveCompilationContext&gt;true&lt;/PreserveCompilationContext&gt;
          &lt;AssetTargetFallback&gt;$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;&lt;/AssetTargetFallback&gt;
          &lt;StartupObject&gt;GLCoderConfiguration.Program&lt;/StartupObject&gt;
        &lt;/PropertyGroup&gt;
  
        &lt;ItemGroup&gt;
          &lt;PackageReference Include="FluentValidation" Version="7.1.1" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="2.0.0" PrivateAssets="All" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.TagHelpers" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.Session" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.NETCore.Platforms" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" /&gt;
          &lt;PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" /&gt;
          &lt;PackageReference Include="NETStandard.Library" Version="2.0.0" /&gt;
          &lt;PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" /&gt;
        &lt;/ItemGroup&gt;
  
        &lt;ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" /&gt;
      &lt;DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" /&gt;
      &lt;DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" /&gt;
    &lt;/ItemGroup&gt;
        &lt;ItemGroup&gt;
          &lt;ProjectReference Include="..\..\SCMEnumerations\SCMEnumerations.csproj" /&gt;
          &lt;ProjectReference Include="..\..\TMainModel\TMainModel.csproj" /&gt;
          &lt;ProjectReference Include="..\..\ViewHelperFunctions\ViewExtensions.csproj" /&gt;
        &lt;/ItemGroup&gt;
  
      &lt;/Project&gt;
  </code></pre>