Antaris / RazorEngine

Open source templating engine based on Microsoft's Razor parsing engine
http://antaris.github.io/RazorEngine
Other
2.14k stars 577 forks source link

RazorEngine.Core.NetCore not work on linux #523

Open IvanZheng opened 6 years ago

IvanZheng commented 6 years ago

When using razorEngineService.RunCompile on linux, I encounter a error "The version of Windows PDB writer is older than required: 'diasymreader.dll'". After investigating, I solve it by removing the check of Mono condition in RoslynCompilerServiceBase.cs as below: //if (IsMono()) //{ opts = opts.WithDebugInformationFormat(DebugInformationFormat.PortablePdb); //} I've verified that it works both on windows and linux. Currently I have to fork the code and fix it to use in my project. Hope it's solved in the next release.

QuickOrBeDead commented 6 years ago

Replacing IsMono method with the IsLinux method below also fixes the error on Linux;

private static bool IsLinux()
{
    return RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
}