How to work custom Identity UI Razor Page of ASP.NET Core in the publish, instead of the default UI RCL after setting RazorCompileOnPublish to false

Viewed 43

Describe the bug:

I can't set to use customize Identity UI Razor Pages after copying release in the publish folder, although I tried various settings with RazorCompileOnPublish = false . I apply the scaffolder to all source code contained in the Identity Razor Class Library (RCL) and I modify the generated source code.

Links such as Identity/Account/Login, /Identity/Account/Manage always display the default UI from Razor Class Library (RCL) from ASP.NET Core Identity

Expected Behavior: My goal is to have customize Identity UI Razor Page source instead of the compiled views dll in the publish folder.

Steps To Reproduce:

• Create ASP.NT Core Razor Page Web App with Frameworks: I try with both .NET 7.22377.5 preview and .NET 6.0.8 Authentication type: Individual Accounts

• I create full Identity UI source to maintain full control of the Identity UI: run the Identity scaffolder and select Override all files.

• In csproj file I add:

<PropertyGroup>             
  <RazorCompileOnBuild>false</RazorCompileOnBuild>
  <RazorCompileOnPublish>false</RazorCompileOnPublish>
</PropertyGroup>

I also tried various combinations of these settings:

<PropertyGroup>             
  <RazorCompileOnBuild>false</RazorCompileOnBuild>
  <CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory> 
  <PreserveCompilationReferences>true</PreserveCompilationReferences>
  <PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>

• In csproj file I include package (to enable runtime compilation for Razor pages): Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation • In Program.cs (to enable runtime compilation for Razor pages ) I add: builder.Services.AddRazorPages().AddRazorRuntimeCompilation();

• Change something in generated Identity file e.g. in \Areas\Identity\Pages\Account\Login.cshtml

• I run Visual Studio and can't see the changes in the Login.cshtml. Instead I see the default UI from Razor Class Library (RCL) from ASP.NET Core Identity.

• I create publish release files Start WebAppApplication.exe, form publish folder, go to /Identity/Account/Login and also I do not see changes in Login.cshtml, instead I see default Identity UI from Razor Class Library (RCL) from ASP.NET Core Identity.

I use: Visual Studio 2022 (64-bit) 17.4.0 Preview 1.0

0 Answers
Related