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.

One or more errors occurred. (Cannot find compilation library location for package 'Microsoft.NETCore.App') (ca5ca414)

See original GitHub issue

I have my .NET Core 2.2 library that has an unexpected behavior on my IIS Server.

I got this issue One or more errors occurred. (Cannot find compilation library location for package ‘Microsoft.NETCore.App’) (ca5ca414).

Note that this issue doesn’t happened when I run the project locally.

Also, I don’t use embedded template, I use string as template.

I tried to put in my .csproj (of my library and in my web app (.Net core API 2.2)) :

< MvcRazorExcludeRefAssembliesFromPublish>false</ MvcRazorExcludeRefAssembliesFromPublish> < CopyRefAssembliesToPublishDirectory>false< /CopyRefAssembliesToPublishDirectory> < MvcRazorCompileOnPublish>false< /MvcRazorCompileOnPublish> < PreserveCompilationContext>true< /PreserveCompilationContext>

Without any result.

Code :

FluentEmail.Core.Email.DefaultRenderer = new RazorRenderer();
            var sender = new MailgunSender("@@@", "@@@");
            FluentEmail.Core.Email.DefaultSender = sender;

 var fluentEmail = FluentEmail.Core.Email
                    .From(email.Sender)
                    .To(email.Recipient.Email)
                    .Subject(email.Content.Subject)
                    .UsingTemplate(template, content);

                var response = await fluentEmail.SendAsync();

  • OS: Windows Server 2016
  • Platform NET Core 2.2
  • RazorLight version 2.0-beta1

C:\Users\Administrator>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.2.105
 Commit:    7cecb35b92

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.105\

Host (useful for support):
  Version: 2.2.3
  Commit:  6b8ad509b6

.NET Core SDKs installed:
  2.1.503 [C:\Program Files\dotnet\sdk]
  2.2.100 [C:\Program Files\dotnet\sdk]
  2.2.103 [C:\Program Files\dotnet\sdk]
  2.2.105 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Publish command :

dotnet.exe publish ProjectName.sln --output C:\TeamCity\buildAgent\work\706005865bacd71f/output @C:\TeamCity\buildAgent\temp\agentTmp\5d3f2082f93940649580add5b1a8d1a2.rsp

There is anything that I miss ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

6reactions
molinchcommented, Jun 6, 2019

In case you wonder, that’s the proper fix, just add these property groups to your entry point csproj. It has to be the entry point project, so the ASP.NET core web project, or your console project, etc

  <PropertyGroup>
    <!-- This group contains project properties for RazorLight on .NET Core -->
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
    <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
  </PropertyGroup>
2reactions
TLA020commented, Jun 3, 2020

In case you wonder, that’s the proper fix, just add these property groups to your entry point csproj. It has to be the entry point project, so the ASP.NET core web project, or your console project, etc

  <PropertyGroup>
    <!-- This group contains project properties for RazorLight on .NET Core -->
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
    <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
  </PropertyGroup>

This worked for me ! thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find compilation library location for package ' ...
I did simple fix for this issue, I selected option to remove additional files at destination before publish and then it solved my...
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
System.InvalidOperationException: Cannot find compilation library location for package 'Microsoft.AspNet.WebApi.Client'. Then I get a 500 error on the page.
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 >
Cannot find compilation library location for package ...
One or more errors occurred. (Cannot find compilation library location for package 'System.Security.Cryptography.Pkcs').
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