Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

"Can not find compilation library location for package.." error right after installing .NET Core 2.0 SDK #6661

Closed
jomargon opened this issue Aug 15, 2017 · 12 comments
Assignees

Comments

@jomargon
Copy link

I have an ASP.NET Core 1.1 website that targets .NET Framework 4.6.1. Now after installing .NET Core SDK 2.0, I can't view any of the pages because of the error:

InvalidOperationException: Can not find compilation library location for package 'xxx'

Below is the stack trace. Not sure if it's really Razor-related. The site works after uninstalling .NET Core 2.0 SDK.

Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths()
Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart+<>c.b__8_0(CompilationLibrary library)
System.Linq.Enumerable+d__16.MoveNext()
Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeatureProvider.PopulateFeature(IEnumerable parts, MetadataReferenceFeature feature)
Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature(TFeature feature)
Microsoft.AspNetCore.Mvc.Razor.Internal.RazorReferenceManager.GetCompilationReferences()
System.Threading.LazyInitializer.EnsureInitializedCore(ref T target, ref bool initialized, ref object syncLock, Func valueFactory)
Microsoft.AspNetCore.Mvc.Razor.Internal.RazorReferenceManager.get_CompilationReferences()
Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService.CreateCompilation(string compilationContent, string assemblyName)
Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService.Compile(RelativeFileInfo fileInfo, string compilationContent)
Microsoft.AspNetCore.Mvc.Razor.Internal.RazorCompilationService.Compile(RelativeFileInfo file)
Microsoft.AspNetCore.Mvc.Razor.Internal.CompilerCache.CreateCacheEntry(string relativePath, string normalizedPath, Func<RelativeFileInfo, CompilationResult> compile)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Razor.Internal.CompilerCache.GetOrAdd(string relativePath, Func<RelativeFileInfo, CompilationResult> compile)
Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorPageFactoryProvider.CreateFactory(string relativePath)
Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet expirationTokens, string relativePath, bool isMainPage)
Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.OnCacheMiss(ViewLocationExpanderContext expanderContext, ViewLocationCacheKey cacheKey)
Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext actionContext, string pageName, bool isMainPage)
Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, string viewName, bool isMainPage)
Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.FindView(ActionContext context, string viewName, bool isMainPage)
Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor.FindView(ActionContext actionContext, ViewResult viewResult)
Microsoft.AspNetCore.Mvc.ViewResult+d__26.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__30.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__28.MoveNext()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResultExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__22.MoveNext()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__20.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Builder.RouterMiddleware+d__4.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Session.SessionMiddleware+d__9.MoveNext()
Microsoft.AspNetCore.Session.SessionMiddleware+d__9.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+d__7.MoveNext()

@Eilon
Copy link
Member

Eilon commented Aug 15, 2017

@pranavkm can you take a look to see what's going on here? Wrong SDK being used maybe?

@pranavkm
Copy link
Contributor

Do you have an repro application that you could share with us?

@jomargon
Copy link
Author

jomargon commented Aug 15, 2017

I created a very simple repro below. The site won't run if .NET Core 2.0 is installed. Apparently it only happens when you add a reference directly to a .NET Framework dll (point to the bin/*.dll of ClassLibrary2). It works if you add a reference to a project.

https://github.com/jomargon/DotNetCore20IssueRepro

@pranavkm
Copy link
Contributor

@jomargon thanks for the repro. This is essentially a dup of dotnet/aspnetcore#2126. I have a work around for it here: dotnet/aspnetcore#2126 (comment)

@jomargon
Copy link
Author

@pranavkm Thanks! Any chance we won't need the workaround on the next minor update? I'd rather wait for a fix than apply the hack.

@Eilon
Copy link
Member

Eilon commented Aug 15, 2017

@pranavkm should this bug be closed as a dup of https://github.com/dotnet/core-setup/issues/2981 ?

@pranavkm
Copy link
Contributor

@Eilon yup. I'll go ahead and close this.
@jomargon I'm working with the CLI team to get the fix in for the 2.0.1 release.

@ganeshmuthuvelu
Copy link

This issue is still happening and not resolved in 2.0.2.
At the same time I do not know for sure if this is resolved in 2.0.2 or not? I see many still seem to have the issue - there are several comments. workarounds, closed as duplicate threads etc., but there is nothing that I could find that clearly says if this is fixed in 2.0.2 or when it will be fixed..

Any help and understanding of our pain will be much appreciated.

@ndeen86
Copy link

ndeen86 commented Nov 8, 2017

I am also facing the issue in 2.0.2. I logged the defect in https://github.com/dotnet/core-setup/issues/3397

@xairrick
Copy link

Has this been fixed? I installed .NET Core 2.1.4 yesterday and it broke a project is using ASP.NET Core 1.1.1

@ganeshmuthuvelu
Copy link

I was about to try upgrading to 2.1.4 after hearing from some that this issue is resolved but looks like this is still a mystery.. Looks like I have to be 1.x for longer :-(
ASP .NET Core Team: Please give us a permanent fix for this issue, I for sure do not need workarounds and so will be many others here.. Thanks for your help!

@Eilon
Copy link
Member

Eilon commented Jan 30, 2018

Hi folks, if you are still seeing this issue, please log a new issue with detailed steps to reproduce the problem. We have not seen this problem in our testing and otherwise believe the issue is fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants