How to develop a simple ASP.NET MVC project without Visual Studio

后端 未结 2 901
孤独总比滥情好
孤独总比滥情好 2020-12-13 02:37

I have been able to develop a simple asp.net project without vs. Can someone help me doing the same for a asp.net mvc 3. Starting from getting the ASP.NET MVC 3 framework. I

2条回答
  •  余生分开走
    2020-12-13 03:00

    Sure, it's pretty easy, only a couple of steps after you install ASP.NET MVC 3.

    1. Fire notepad.exe and create a HomeController.cs file (Of course if you don't want to use notepad you could also do this by using the copy con HomeController.cs command on the command prompt, this way you will be closer to the metal):

      namespace MyApplication
      {
          using System.Web.Mvc;
      
          public class HomeController : Controller
          {
              public ActionResult Index()
              {
                  return View();
              }
          }
      }
      
    2. Compile on the command prompt (adjust the folders to match yours)

      c:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /t:library /out:MyApplication.dll /r:"C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll" HomeController.cs
      
    3. Create a folder c:\MyApplication

    4. Create a folder c:\MyApplication\bin and copy MyApplication.dll to this bin folder.
    5. Inside c:\MyApplication\web.config:

      
      
        
          
          
          
        
      
        
          
            
              
              
              
              
              
            
          
      
          
            
              
              
              
              
              
              
            
          
        
      
        
          
          
        
      
      
      
    6. Inside c:\MyApplication\Views\web.config:

      
      
      
        
          
            
    7. Inside c:\MyApplication\Global.asax:

      <%@ Application Language="C#" %>
      <%@ Import Namespace="System.Web.Mvc" %>
      <%@ Import Namespace="System.Web.Routing" %>
      
      
    8. Inside c:\MyApplication\Views\Home\Index.cshtml:

      
      
      
          
          
      
      
      
          Hello Word
      
      
      
    9. Now you have all the necessary files for an ASP.NET MVC 3 application. The final step is to host it on a web server and run it.


    Conclusion: unless you are suffering from some severe brain damage you will never do this and simply download Visual Studio 2010 Express and start developping ASP.NET MVC 3 applications by following the tutorials on the ASP.NET MVC web site.

提交回复
热议问题