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.

Helpers.vbhtml
@Helper GetTime()
@DateTime.Now
End Helper
But this results in the error Type 'ASP.global_asax' is not defined. (x2)

Nothing seems to be affected - the application still compiles and runs. What's this error mean?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With