Reuse MVC4 codebase / deploy MVC4 as standalone desktop application

asp.net-mvcdesktop application

We have an MVC4 application that we would also need to distribute as a standalone (no network connectivity) desktop application. Rather than rebuild the HTML/JS front-end we would like to reuse that so in essence we're distributing a self-hosted HTML-view-based .NET MVC application. What we roughly envision is: MVC4 .NET DLL + JS libraries + Self-hosted HTTP core + self/embedded browser view. For this standalone desktop app, we're only concerned with Windows OS.

Question: Is that practically doable or just a theoretical idea? How would we practically go about achieving that? We are attempting to minimize codebase fragmentation (and duplicate maintenance). We anyways have to support IE for the "online" version of the MVC app.

To Clarify: The user experience we would like to have is:

  • Single large .exe file that encapsulates all resources within it
  • Double clicking it launches a rectangle window within which the HTML app is rendered. This would be similar to how iOS apps have an "HTML view" which uses the OS's in-built HTML renderer (on Windows I assume it's IE?)

Best Answer

Using the ASP.NET hostable web core will allow you to host the ASP.NET runtime in your application. This means you can create your own local webserver, running ASP.NET MVC, webforms, or any other frameworks you choose to use. Have a look at this blog entry.

This is separate from IIS and you do not need to need to set up or configure IIS; simply having the .NET framework installed is sufficient.

The way you would likely distribute this is as a folder installed to the hard drive.

Related Topic