toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.52k stars 259 forks source link

Method 'CreateAnalyzerDriver' in type 'Microsoft.CodeAnalysis.CSharp.CSharpCompilation' from assembly 'Microsoft.CodeAnalysis.CSharp, Version=3.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation. #456

Closed nkr-sjanofsky closed 3 years ago

nkr-sjanofsky commented 3 years ago

Migrating a web app from .NET Core 2.2 => .NET Core 3.1 and seeing this error when running CompileRenderAsync.

The project does not make use of DI to instantiate the engine, it uses the following code instead:

var type = model.GetType().Assembly.GetType("Nkr.Model.Root");

var engine = new RazorLightEngineBuilder()
                .UseEmbeddedResourcesProject(type)
                .SetOperatingAssembly(assembly)
                .UseMemoryCachingProvider()
                .Build();

var resultTask = engine.CompileRenderAsync(resourceName, model);
return resultTask.Result;

Is it required to use DI to instantiate the engine?

Am I missing something in the above code?

nkr-sjanofsky commented 3 years ago

This seems to be something on my end..