0

Using Visual Studio for Mac (Community 7.3), I am trying to run the sample project from Lynda.com's "Learning ASP.NET Core MVC" Chapter 3 which introduces "Render HTML with Razor".

I builds find but when I try to load in browser I get the error below:

An unhandled exception occurred while processing the request.

InvalidOperationException: Can not find compilation library location for package 'Newtonsoft.Json' Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths()

Stack Query Cookies Headers InvalidOperationException: Can not find compilation library location for package 'Newtonsoft.Json' Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths() System.Linq.Enumerable+d__157.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.DefaultRoslynCompilationService.GetCompilationReferences() System.Threading.LazyInitializer.EnsureInitializedCore(ref T target, ref bool initialized, ref object syncLock, Func valueFactory) Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService.get_CompilationReferences() Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService.Compile(RelativeFileInfo fileInfo, string compilationContent) Microsoft.AspNetCore.Mvc.Razor.Internal.CompilerCache.CreateCacheEntry(string relativePath, string normalizedPath, Func 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 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__32.MoveNext() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__31.MoveNext() Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__29.MoveNext() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__23.MoveNext() Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__18.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) System.Runtime.CompilerServices.TaskAwaiter.GetResult() ExploreCalifornia.Startup+<>c+<b__3_0>d.MoveNext() in Startup.cs await next(); System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+d__6.MoveNext()

Show raw exception details

Nik Edmiidz
  • 72
  • 1
  • 6
  • Check the Nuget packages of the project. If Newtonsoft.Json is not installed, install it! – Bassem Dec 12 '17 at 06:13
  • Which version? I have over 20 to choose from, from 3.5.8 to 10.0.3 My project target framework is .Net Core 1.0. – Nik Edmiidz Dec 12 '17 at 06:36
  • In the Packages.Config file of the project, you will find all the details you need. – Bassem Dec 12 '17 at 06:42
  • In the Packages.Config file all I see is: Anyway I installed Newtonsoft.Json version 10.0.3 Now I get: Can not find compilation library location for package 'Microsoft.CSharp' So I installed Microsoft.CSharp (4.4.0) but the error doesn't change. – Nik Edmiidz Dec 12 '17 at 18:39

0 Answers0