当 asp-page tag helper 的值不正确时是否可能触发编译时错误?
Is it possible to trigger a compile time error when the value for asp-page tag helper is incorrect?
在带有 Razor Pages 的 ASP.NET 核心项目中,如果另一个页面的路径被定义为 asp- 的值,是否可以配置一些会产生编译时错误或至少警告的东西页面(和相关属性)不正确?
例如:
<a class="nav-link" asp-page="/Admin/User/Index">Users</a>
假设这里有错字,值应该是 /Admin/Users/Index
。据我所知,这被默默地忽略了,根本没有生成 href,这很糟糕。
如果在 build/compile 时间内触发错误那就太棒了,因为 razor 模板无论如何都要编译。
is it possible to configure something that would generate compile time errors or at least warnings if the path to another page defined as the value for asp-page (and related attributes) is incorrect?
根据 source code.
没有办法做到这一点
标签助手调用Generator.GeneratePageLink
方法生成link.The编译器无法在编译时调用此方法。
在带有 Razor Pages 的 ASP.NET 核心项目中,如果另一个页面的路径被定义为 asp- 的值,是否可以配置一些会产生编译时错误或至少警告的东西页面(和相关属性)不正确?
例如:
<a class="nav-link" asp-page="/Admin/User/Index">Users</a>
假设这里有错字,值应该是 /Admin/Users/Index
。据我所知,这被默默地忽略了,根本没有生成 href,这很糟糕。
如果在 build/compile 时间内触发错误那就太棒了,因为 razor 模板无论如何都要编译。
is it possible to configure something that would generate compile time errors or at least warnings if the path to another page defined as the value for asp-page (and related attributes) is incorrect?
根据 source code.
没有办法做到这一点标签助手调用Generator.GeneratePageLink
方法生成link.The编译器无法在编译时调用此方法。