Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My Helpers.vbhtml file results in "Type 'ASP.global_asax' is not defined"

I created the ASP.NET special folder called App_Code in my MVC project. I added a new file Helpers.vbhtml that will contain repeatedly-used razor code snippets.

Folder structure

Helpers.vbhtml

@Helper GetTime()
    @DateTime.Now
End Helper

But this results in the error Type 'ASP.global_asax' is not defined. (x2)

Error

Nothing seems to be affected - the application still compiles and runs. What's this error mean?

like image 568
Rowan Freeman Avatar asked Sep 11 '13 06:09

Rowan Freeman


1 Answers

This error is caused by a naming conflict; there is a namespace called System.Web.Helpers.

The problem appears to be VB.NET-specific. I can't reproduce the problem in C#.

Rename the .vbhtml file to Snippets.vbhtml or something else that won't cause a naming conflict.

like image 54
Rowan Freeman Avatar answered Nov 10 '22 02:11

Rowan Freeman