“ASP.global_asax does not exist in the namespace ASP”

后端 未结 9 2260
梦毁少年i
梦毁少年i 2020-12-23 08:56

I created a RazorFunctions.cshtml file on App_Code

@functions {
    public static string GetActiveClassIf(string controllerName, string actionName = null)
           


        
9条回答
  •  醉话见心
    2020-12-23 09:54

    After further investigation I found that this is a known issue.

    source: https://support.microsoft.com/en-us/kb/3025133

    ASP.NET and Web Development

    • When you create a Web Forms 4.5 WAP and open a Web Form page, you receive the following errors in the Errors List window:

    • The project will run without any issues. Error CS0234 The type or namespace name 'global_asax' does not exist in the namespace 'ASP' (are you missing an assembly reference?) Error CS0234 The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) Assume that you use new language features for C# and VB in Visual Studio 2015 RC. You receive a runtime error when you use C# or VB in a Web Form page or in Razor Views.

    To work around this issue, install Microsoft.CodeDom.Providers.DotNetCompilerPlatform NuGet package. This package will substitute the Roslyn-based provider for the in-box CodeDom providers for ASP.NET.

提交回复
热议问题