VB.NET Install Notes

srkirkland edited this page Mar 8, 2012 · 1 revision

If you want to run the Data Annotations Extensions MVC3 Nuget Package with VB.NET, you need to add a little bit of code so the new validators are initialized properly when your application starts.

The easiest method is to just call the initialize method from inside your Global.asax file inside the Application_Start method, like so:


If you want to see a this in the context of a full global.asax file in MVC3, you can look at this gist. (Line 31 in particular)

Option 2: Initialize Validators With An App_Start File

If you would rather initialize the validators within your App_Start folder (using Web Activator), then you can make a new file inside your App_Start folder using the following code: (See the gist here)

Imports DataAnnotationsExtensions.ClientValidation

<Assembly: WebActivator.PreApplicationStartMethod(GetType(App_Start.RegisterClientValidationExtensions), "Start")>

Namespace App_Start
    Public NotInheritable Class RegisterClientValidationExtensions
        Private Sub New()
        End Sub
        Public Shared Sub Start()
        End Sub
    End Class
End Namespace
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.