I created a RazorFunctions.cshtml file on App_Code
@functions {
public static string GetActiveClassIf(string controllerName, string actionName = null)
Two things i did to resolve this was to re-target the framework and then changing it back (was using 4.5.1 changed it to 4.5 and back)
After this i had a lot of error with T4MVC which i was also using, i upgraded it to newest version but i could see that in source control that T4MVC was installed targeting framework 4.5 and when you re/install a new nuget package it changes the target framework, so that was changed to 4.5.1
After this everything worked. I didn't test if you only need to do that second part of this answer, but i would try that first.