Cannot find compilation library location for package 'Microsoft.NETCore.App'
See original GitHub issueDescribe 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:
- Created 5 years ago
- Reactions:14
- Comments:17
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solve the problem, putting this on csproj
The key is the “MvcRazorExcludeRefAssembliesFromPublish” tag
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.