add razor live view

This commit is contained in:
Muhammad Azeez 2021-01-18 11:32:31 +03:00
parent 6e7f80e147
commit 3735ef928c
2 changed files with 12 additions and 0 deletions

View File

@ -9,6 +9,7 @@
<PackageReference Include="IdentityModel" Version="5.0.0-preview.2" /> <PackageReference Include="IdentityModel" Version="5.0.0-preview.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.1" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.1" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.1" />
<PackageReference Include="Westwind.AspNetCore.LiveReload" Version="0.3.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -17,6 +17,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Threading.Tasks; using System.Threading.Tasks;
using Westwind.AspNetCore.LiveReload;
namespace OidcSamples.TaxApp namespace OidcSamples.TaxApp
{ {
@ -40,6 +41,13 @@ namespace OidcSamples.TaxApp
services.AddRazorPages().AddRazorRuntimeCompilation(); services.AddRazorPages().AddRazorRuntimeCompilation();
services.AddLiveReload(config =>
{
// optional - use config instead
//config.LiveReloadEnabled = true;
//config.FolderToMonitor = Path.GetFullname(Path.Combine(Env.ContentRootPath,"..")) ;
});
services.AddControllersWithViews(); services.AddControllersWithViews();
services.AddAuthentication(options => services.AddAuthentication(options =>
@ -93,6 +101,9 @@ namespace OidcSamples.TaxApp
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ {
// IMPORTANT: Before **any other output generating middleware** handlers including error handlers
app.UseLiveReload();
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();