question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RazorLight requires ASP.NET Core runtime

See original GitHub issue

Describe the bug

Because RazorLight has a FrameworkReference to Microsoft.AspNetCore.App, the user is expected to have the corresponding runtime. This is a show stopper for console or WPF apps as users of those will not have it installed (and shouldn’t need to).

To Reproduce

  1. Create a WPF app
  2. Add RazorLight
  3. Publish it
  4. Try running on a machine where neither ASP.NET Core runtime nor SDK is installed

image

Expected behavior

It should work with just the base .NET Runtime.

Information (please complete the following information):

  • OS: Win10 x64
  • Platform .NET Core 3.1
  • RazorLight version 2.0-beta9
  • Are you using the OFFICIAL RazorLight package? yes
  • Rider 2020.1.3

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:30 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
jzabroskicommented, Jan 12, 2021

Off topic, but compile templates at build time is a feature that RazorLight should have.

OK, please add it 😃

4reactions
karobertscommented, Sep 6, 2020

I tried removing this from RazorLight for core 3.0 and 3.1 <FrameworkReference Include="Microsoft.AspNetCore.App" /> and added this <PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="2.2.0" />

and then put this into RazorLight.Tests for core 3.0 and 3.1 <FrameworkReference Include="Microsoft.AspNetCore.App" />

After that, everything compiled and all unit tests pass. I did not see the errors shown above.

I think the only reason that the framework reference is necessary is because the tests project uses some aspnetcore types like Microsoft.AspNetCore.Hosting.IHostingEnvironment

Read more comments on GitHub >

github_iconTop Results From Across the Web

toddams/RazorLight: Template engine based on ...
Applications must add an explicit reference to the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package if the app relies on runtime compilation to process ...
Read more >
RazorLight requires ASP.NET Core runtime
Describe the bug. Because RazorLight has a FrameworkReference to Microsoft.AspNetCore.App , the user is expected to have the corresponding runtime.
Read more >
Razor file compilation in ASP.NET Core
Build-time and publish-time compilation of Razor files is enabled by default by the Razor SDK. When enabled, runtime compilation complements ...
Read more >
PreserveCompilationContext not configured by default - .NET
Razor.RuntimeCompilation configure this property as required. Version introduced. ASP.NET Core 6.0. Old behavior. The dependency file contains ...
Read more >
Publish .cshtml views for RazorLight in .net core 3.0
Yet when I publish, I see no EmailTemplates folder and no ForgotPassword.cshtml and Registration.cshtml . What am I doing wrong? asp.net-core ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found