Skip to content

Could not load file or assembly 'Microsoft.CodeAnalysis #23

@Nilotaviano

Description

@Nilotaviano

I'm trying to use this lib to generate HTML on an Azure Function, not sure what could be going wrong here.

public static string RenderViewToString(RedactedViewModel model)
{
    const string templateName = "redacted";
    string viewPath = Path.Combine(Constants.VIEW_FOLDER_PATH, templateName + ".cshtml");

    return new RazorEngine()
        .Compile(File.ReadAllText(viewPath))
        .Run(model);
}

System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Source=RazorEngineCore
StackTrace:
at RazorEngineCore.RazorEngineCompilationOptions..ctor()
at RazorEngineCore.RazorEngineCompilationOptionsBuilder..ctor(RazorEngineCompilationOptions options)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions