Mike Mertsock - 301 - Mar 7, 2014

We’ve been using the Markdown Razor feature for a while. This week we’re upgrading from ServiceStack 3 to 4. When we deployed the upgraded app to our server, we got errors on our markdown page:

System.IO.FileNotFoundException: Could not infer .NET Reference Assemblies path, e.g ‘C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0’.

To fix the above exception, and some other related exceptions after that one, we added System.Core.dll and mscorlib.dll to the v4.5 reference assemblies folder on the server, and recycled the app pool.

We’re wondering if this is a known change in behavior with ServiceStack 4. Looking through the history for Env.cs in ServiceStack.Text and some of the Markdown code in ServiceStack, it wasn’t obvious what might have changed.

Also we found what appears to be a bug with the if/else logic preceeding the throw statement here: https://github.com/ServiceStack/ServiceStack.Text/blob/master/src/ServiceStack.Text/Env.cs#L88 - note what happens if the v4.0 directory exists but v4.5 directory does not.

Yeah it’s annoying requirement in .NET 4.0+, as the c# CodeDom provider used in Markdown Evaluator needs a reference to the ReferenceAssemblyPath of System.Core.dll to compile .NET 4.0 code in .NET.