Getting Started

I assume you don't want to write your whole MVC app in VB. I know I don't. Therefore you will need two projects in your solution.

We are going to split our website into a front-end and back-end. The font-end is a VB web application project and contains views, images, scripts, css, etc. The back-end is a C# class library and has all the web application code. The font-end has a reference to the back-end.

The Sample folder in the Hasic source has a minimal example of this setup. I suggest you copy that to get started. I'll also highlight a few key points here.

HttpApplication

We have to subclass HttpApplication in the C# project (to register routes, etc). The Global.asax file in the VB project has no code behind and inherits the C# custom HttpApplication.

<%@ Application Inherits="Sample.SampleApplication" %>

The C# HttpApplication subclass will register the Hasic view engine with code like this:

public static void RegisterViewEngine(ViewEngineCollection engines)
{
    var engine = new Hasic.XDocumentViewEngine(Assembly.Load("Sample.Front"));
    engines.Add(engine);
}

There is a circular dependency here, so we have to use the name of the front-end assembly to tell Hasic where the views are.

Default Xml Namespace

When creating XML literals in VB we need to tell the compiler which namespace to use. Do this at the project level. Open the project properties, go to the References tab. Under Imported namespaces add <xmlns="http://www.w3.org/1999/xhtml"> then click "Add User Import".