A Visual Studio Extension in a Weekend
I wanted to write a Visual Studio extension (for VS2012) that, when you open a solution, renders and displays Markdown documentation in Visual Studio.
I wanted to write a Visual Studio extension (for VS2012) that, when you open a solution, renders and displays Markdown documentation in Visual Studio.
When you create a web application in Visual Studio, you can configure it (on the properties page) to run in IIS Express.
An aside: We need to be able to support multiple instances of our small web application (because you might have more than one instance of Visual Studio open). If we host our application in IIS Express (and remember that we’re doing this to avoid messing around with URL ACLs), we either need to duplicate the whole thing for each site, or figure out a way to provide it with parameters.
Using the web browser that’s built into Visual Studio is dead simple:
There are several options for rendering Markdown to HTML in .NET. If you bring
up the NuGet Package Manager dialog and search for “markdown”, you get three
pages of results, including MarkdownSharp
, which is the renderer used by
Stack Overflow, so it must be good.
The next major piece is the Visual Studio extension, so let’s get on with that. Assuming that you’ve installed the Visual Studio 2012 SDK, it’s as simple as creating a new “Visual Studio Package” (it’s under “Visual C#” / “Extensibility”):
A brief aside: I’ve got to the point where I’m about to fire up IIS Express from Visual Studio. In order to be a good citizen, our extension should probably shut it down again later.
Next problem: packaging the vs-welcome-page
extension.
So, why did I use IIS Express to implement my vs-welcome-page extension? I’m using Nancy, so why didn’t I just use the self-hosting support and host it inside Visual Studio instead?