Skip to content

Commit

Permalink
Restore reload Razor View on change if DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Jan 30, 2020
1 parent 3454733 commit dc7682f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions MyApp/MyApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.0" />

<!-- Required for Razor compilation on change: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.1 -->
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.0" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 7 additions & 3 deletions MyApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ public class Startup

// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public new void ConfigureServices(IServiceCollection services)
public void ConfigureServices(IServiceCollection services)
{
System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();

#if DEBUG
services.AddMvc(options => options.EnableEndpointRouting = false).AddRazorRuntimeCompilation();
#else
services.AddMvc(options => options.EnableEndpointRouting = false);
#endif

System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();

services.AddAuthentication(options =>
{
Expand Down

0 comments on commit dc7682f

Please sign in to comment.