I created a RazorFunctions.cshtml file on App_Code
@functions { public static string GetActiveClassIf(string controllerName, string actionName = null)
The way I resolved this error was to move my code form Global.asax.cs into Startup.cs and delete Global.asax so that there aren't any codebehind files in my project. See this question for more info.