How can I implement a site with ASP.NET MVC without using Visual Studio?

Posted by Cheeso on Stack Overflow See other posts from Stack Overflow or by Cheeso
Published on 2010-03-15T23:17:23Z Indexed on 2010/03/16 15:51 UTC
Read the original article Hit count: 276

Filed under:
|

I have seen ASP.NET MVC Without Visual Studio, which asks, Is it possible to produce a website based on ASP.NET MVC, without using Visual Studio?

And the accepted answer is, yes.

Ok, next question: how?


Here's an analogy. If I want to create an ASP.NET Webforms page, I load up my favorite text editor, create a file named Something.aspx. Then I insert into that file, some boilerplate:

<%@ Page Language="C#"
  Debug="true"
  Trace="false"
  Src="Sourcefile.cs"
  Inherits="My.Namespace.ContentsPage"
%>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Title goes here </title>
    <link rel="stylesheet" type="text/css" href="css/style.css"></link>

    <style type="text/css">
      #elementid {
          font-size: 9pt;
          color: Navy;
         ... more css ...
      }
    </style>

    <script type="text/javascript" language='javascript'>

      // insert javascript here.

    </script>

  </head>

  <body>
      <asp:Literal Id='Holder' runat='server'/>
      <br/>
      <div id='msgs'></div>
  </body>

</html>

Then I also create the Sourcefile.cs file:

namespace My.Namespace
{
    using System;
    using System.Web;
    using System.Xml;
    // etc... 

    public class ContentsPage : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.Literal Holder;

        void Page_Load(Object sender, EventArgs e)
        {
            // page load logic here
        }
    }
}

And that is a working ASPNET page, created in a text editor. Drop it into an IIS virtual directory, and it's working.

What do I have to do, to make a basic, hello, World ASPNET MVC app, in a text editor? (without Visual Studio)

Suppose I want a basic MVC app with a controller, one view, and a simple model. What files would I need to create, and what would go into them?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc