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.

Cannot find compilation library location for package 'Microsoft.NETCore.App'

See original GitHub issue

Describe the bug My code run ok on developer machine. But not in Azure WebApp production.

Im using .Net Core 2.1. I get this error

Cannot find compilation library location for package 'Microsoft.NETCore.App'

To Reproduce Steps to reproduce the behavior:

string html = await _engine.CompileRenderAsync(templateKey, razor, data);

Expected behavior A clear and concise description of what you expected to happen.

Information (please complete the following information):

  • OS: Windows Server 2016 (Azure WebApp) Plataform: .NET Core 2.1
  • RazorLight version : e.g 2.0-beta1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:14
  • Comments:17

github_iconTop GitHub Comments

55reactions
penihelcommented, Jul 9, 2018

I solve the problem, putting this on csproj

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
   <PreserveCompilationContext>true</PreserveCompilationContext>
   <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
  </PropertyGroup>

The key is the “MvcRazorExcludeRefAssembliesFromPublish” tag

6reactions
sguryevcommented, Nov 9, 2018

The main problem in using Library for storing the Embedded Views. Here is an explanation: https://github.com/aspnet/Mvc/issues/6021

So I had to clean up the library csproj file from any additional configuration and add <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish> to the WebApp itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find compilation library location for package ...
Just upgraded a web project to .NET 6.0. Project compiles but when I run the site I get the following error: InvalidOperationException: Cannot...
Read more >
Cannot find compilation library location for package ...
Within my launchsettings.json file I created profile for IIS (Not IISExpress). When I run this application, I get the below error:.
Read more >
Cannot find compilation library location for package 'Micros
InvalidOperationException: Cannot find compilation library location for package 'Microsoft.AspNet.WebApi.Client'. Then I get a 500 error on the page.
Read more >
"Can not find compilation library location for package.." error ...
The site works after uninstalling .NET Core 2.0 SDK. Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths() Microsoft.
Read more >
Solution for the error “Cannot find compilation library location ...
Solution for the error “Cannot find compilation library location for package 'Microsoft.Win32.Registry” : .Net Core Errors Part II.
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