Got an interesting piece of anonymous feedback today reminding me of something rather obvious…
How exactly do you install CobaltMVC?
Oh yeah… That would be handy information… and it probably should have already been released. That said, lets get right to it.
Add CobaltMVC To Your Project
Unpack the files to an easy to reach location and then add them as references to your project. You don’t need to add both, the
Cobalt.dll is good enough.
Next, open up the
Global.asax file and include the
Cobalt.CobaltConfiguration.Initialize(); call to the
Application_Start method. This makes sure that CobaltMVC is set up fully before it begins processing requests.
Update Web.config (sorta optional)
This step can be skipped but it will make coding your pages less convenient since you’ll have to add the namespaces all over the rest of your project. Add the
Cobalt and the
Cobalt.Web namespaces to your
system.web/pages/namespaces section. This opens up the extension methods used to start Cobalt commands from your views.
At this point we can test CobaltMVC to see if it is working. For example, here is a command you can run on the default MVC Index view.
And you’ll get the following results…
Not bad, huh?
It is worth mentioning that CobaltMVC might have unexpected results if you use
.browser files with your project. Why?
Well, part of the
Initialize() call actually creates a
.browser file that is used to capture rendering for content on the page.
So, if you see this file floating around in your project, don’t delete it.
Who knows what happens when too many
.browser files are fighting for the same thing but I doubt it will be a good thing.