Vici MVC requires Service Pack 1 of Visual Studio 2005. This is necessary to allow debugging of web applications, but stricly speaking, you could just create a class library project, and it will work.
But let's assume you have service pack 1 installed.
The following things need to be setup to create a Vici MVC web application:
Make sure you select "ASP.NET Web Application".
You can safely delete the Default.aspx file, since we don't need any Web Forms.
Every Vici MVC application needs a static application class with a static Init() method, which is required to initialize your application:
The web.config has to be changed for Vici MVC. You should add HTTP modules and handlers for both IIS 6.0 and IIS 7.0.
In addition, you also have to tell Vici MVC where to find the application class. You should do that in web.config. Just add a key "Mvc.ApplicationClass" with the (fully qualified) name of the application class:
web.config
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<appSettings>
<add key="Mvc.ApplicationClass" value="WebApplication1.App, WebApplication1" />
<add key="Mvc.TemplatePath" value="templates" />
</appSettings>
<system.web>
<httpHandlers>
</httpHandlers>
<httpModules>
<add name="MvcModule" type="Vici.Mvc.HttpModule, Vici.Mvc" />
</httpModules>
<compilation debug="true"/>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<directoryBrowse enabled="true" />
<modules runAllManagedModulesForAllRequests="true">
<add name="MvcModule" type="Vici.Mvc.HttpModule, Vici.Mvc" />
</modules>
<handlers>
<add name="MvcHandler" preCondition="integratedMode" verb="*"
path="ProMesh.axd"
type="Vici.Mvc.MVCHandler, Vici.Mvc" />
</handlers>
</system.webServer>
</configuration>
Next, you should create a folder where your HTML templates will be stored.
All pages need a "layout" template, which is a master page where all common elements (like navigation menu) are located. The default name of the layout template is "master.htm". Let's just create a simple one and put it in the "templates" folder (right-click on the templates folder, choose "Add New Item", "HTML Page")
The layout template should have at least the {{@View}} tag. This is where the view will be rendered
Controllers usually render a view, which is a HTML file that will be rendered inside the layout template we just created, so you should create at least one controller and one view:
Create the controller class:
class Index : Controller { public void Run() { ViewData["Text"] = "Hello World"; } }
The view is a HTML file which should be created in the templates folder. By default, it has the same name as the controller:
templates/Index.htm
<html xmlns="http://www.w3.org/1999/xhtml" > <body> {{Text}} </body> </html>
In the application class we told Vici MVC to use default routing, which means that the name of the page we specify in the URL is the name of the controller, so to call our controller we just created, you should load the following URL:
To make things easier, we will tell Visual Studio to make this the default:
Right-click the application in Solution Explorer, choose properties and select the bottom tab "Web". Select "Specific page" as "Start Action", and enter index:
Now you simply have to press F5 to start your web application.