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(IEnumerableparts, 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, Funccompile)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Razor.Internal.CompilerCache.GetOrAdd(string relativePath, Funccompile)
Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorPageFactoryProvider.CreateFactory(string relativePath)
Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSetexpirationTokens, 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()
@pranavkm can you take a look to see what's going on here? Wrong SDK being used maybe?
Do you have an repro application that you could share with us?
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.
@jomargon thanks for the repro. This is essentially a dup of https://github.com/aspnet/Home/issues/2126. I have a work around for it here: https://github.com/aspnet/Home/issues/2126#issuecomment-322325498
@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.
@pranavkm should this bug be closed as a dup of https://github.com/dotnet/core-setup/issues/2981 ?
@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.
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.
I am also facing the issue in 2.0.2. I logged the defect in https://github.com/dotnet/core-setup/issues/3397
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
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!
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.
Most helpful comment
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.