6

I ran into this error with .NET Core 2.0 and .NET Core 2.1, while using RazorLight coupled with cshtml Razor template files for FluentEmail, in an ASP.NET Core app:

"Cannot find compilation library location for package XYZ"

Where XYZ seemed to change depending on what version of .NET Core I had deployed.

The error did not present itself in my dev environment, but reared its head after deployment, when hitting any API endpoint that required FluentEmail to use the Razor template files to generate the email body.

1 Answer 1

12

Publish-time compilation of Razor files is enabled by default. In my case, I did not need this feature, because my Razor templates were being compiled by FluentEmail at runtime. By adding <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish> to the app's csproj file, publish-time compilation was disabled, and the error resolved.

Example csproj entry:

<PropertyGroup>
  <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
</PropertyGroup>
2
  • 1
    You saved my day:) Had the same issue. Thx for the solution. Commented Sep 27, 2018 at 13:48
  • For some reason this solution didn't help me. I have described details here: github.com/toddams/RazorLight/issues/203. Any help\ideas are really appreciated.
    – SerjG
    Commented Nov 6, 2018 at 13:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.