Failed to compile generated razor view. See CompilationErrors for detailed information
Hello, I'm trying to use a non-anonymous object and am getting the following error:
Failed to compile generated razor view. See CompilationErrors for detailed information
public class TestModel
{
public string Name { get; set; }
}
var model = new TestModel()
{
Name = "John Doe"
};
var engine = EngineFactory.CreatePhysical(@"D:\");
string result = engine.ParseString("Hello @Model.Name ", model, model.GetType());
Hi
Try to execute this code in debug mode and look on CompilationErrors of an exception. It must provide you with a detailed information
CompilationErrors:
The type or namespace name 'TestModel' could not be found (are you missing a using directive or an assembly reference?)
Same error happens when you do not specify a model type? I mean without model.GetType()?
Another question: model is declared at the same assembly where you use RazorLight?
Yes for their 2 questions. I'm using: "RazorLight": "1.0.0-rc1",
Seem to be a bug, thank you for the report
Fixed