I created a razor project for .net-9.0 (see gist) using this command
dotnet new razor -au Individual --use-program-main
I copied the files Index*
and added them as OrderList*
and added [Authorize]
like this
// file RazorAuthInd\Pages\Orders\OrderList.cshtml.cs
[Authorize]
public class OrderListModel : PageModel
and did run dotnet watch run
and got this warning
dotnet watch ⌚ File updated: .\Pages\Orders\OrderList.cshtml
dotnet watch ⚠ [RazorAuthInd (net9.0)] Expected to find
a static method 'ClearCache' or 'UpdateApplication'
on type 'Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlAttributePropertyHelper,
Microsoft.AspNetCore.Mvc.ViewFeatures,
Version=9.0.0.0, Culture=neutral, PublicKeyToken=xxx'
but neither exists.
It is not clear to me where and how i should add these methods.
See this gist with code and instructions to reproduce.
The file Pages\Orders\OrderList.cshtml
as this content
@page
@model OrderListModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1 class="display-4">Order List</h1>
<p>Learn about <a href="https:foo">building ..</a>.</p>
</div>
And Pages\Orders\OrderList.cshtml.cs
as this content
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace RazorAuthInd.Pages;
[Authorize]
public class OrderListModel : PageModel
{
private readonly ILogger<OrderListModel> _logger;
public OrderListModel(ILogger<OrderListModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
}
You aren't expected to do anything with this warning. It relates to internal stuff that is used to manage Hot Reload. Looks like it has been fixed as part of .NET 10: https://github.com/dotnet/aspnetcore/pull/58558