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


i have been able develop simple asp.net project without vs. can me doing same asp.net mvc 3. starting getting asp.net mvc 3 framework. seems can't download anymore assemblies. possible have project compiled on fly ( mean without compiling web application letting iis doing , possible achieve regular asp.net assume possible mvc framework)

thx dave

sure, it's pretty easy, couple of steps after install asp.net mvc 3.

  1. fire notepad.exe , create homecontroller.cs file (of course if don't want use notepad using copy con homecontroller.cs command on command prompt, way closer metal):

    namespace myapplication {     using system.web.mvc;      public class homecontroller : controller     {         public actionresult index()         {             return view();         }     } } 
  2. compile on command prompt (adjust folders 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 folder c:\myapplication

  4. create folder c:\myapplication\bin , copy myapplication.dll bin folder.
  5. inside c:\myapplication\web.config:

    <?xml version="1.0"?> <configuration>   <appsettings>     <add key="webpages:version" value="1.0.0.0"/>     <add key="clientvalidationenabled" value="true"/>     <add key="unobtrusivejavascriptenabled" value="true"/>   </appsettings>    <system.web>     <compilation debug="true" targetframework="4.0">       <assemblies>         <add assembly="system.web.abstractions, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />         <add assembly="system.web.helpers, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />         <add assembly="system.web.routing, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />         <add assembly="system.web.mvc, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />         <add assembly="system.web.webpages, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />       </assemblies>     </compilation>      <pages>       <namespaces>         <add namespace="system.web.helpers" />         <add namespace="system.web.mvc" />         <add namespace="system.web.mvc.ajax" />         <add namespace="system.web.mvc.html" />         <add namespace="system.web.routing" />         <add namespace="system.web.webpages"/>       </namespaces>     </pages>   </system.web>    <system.webserver>     <validation validateintegratedmodeconfiguration="false"/>     <modules runallmanagedmodulesforallrequests="true"/>   </system.webserver>  </configuration> 
  6. inside c:\myapplication\views\web.config:

    <?xml version="1.0"?>  <configuration>   <configsections>     <sectiongroup name="system.web.webpages.razor" type="system.web.webpages.razor.configuration.razorwebsectiongroup, system.web.webpages.razor, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35">       <section name="host" type="system.web.webpages.razor.configuration.hostsection, system.web.webpages.razor, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" />       <section name="pages" type="system.web.webpages.razor.configuration.razorpagessection, system.web.webpages.razor, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" />     </sectiongroup>   </configsections>    <system.web.webpages.razor>     <host factorytype="system.web.mvc.mvcwebrazorhostfactory, system.web.mvc, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />     <pages pagebasetype="system.web.mvc.webviewpage">       <namespaces>         <add namespace="system.web.mvc" />         <add namespace="system.web.mvc.ajax" />         <add namespace="system.web.mvc.html" />         <add namespace="system.web.routing" />       </namespaces>     </pages>   </system.web.webpages.razor>    <appsettings>     <add key="webpages:enabled" value="false" />   </appsettings>    <system.web>     <httphandlers>       <add path="*" verb="*" type="system.web.httpnotfoundhandler"/>     </httphandlers>      <pages         validaterequest="false"         pageparserfiltertype="system.web.mvc.viewtypeparserfilter, system.web.mvc, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"         pagebasetype="system.web.mvc.viewpage, system.web.mvc, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"         usercontrolbasetype="system.web.mvc.viewusercontrol, system.web.mvc, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35">       <controls>         <add assembly="system.web.mvc, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" namespace="system.web.mvc" tagprefix="mvc" />       </controls>     </pages>   </system.web>    <system.webserver>     <validation validateintegratedmodeconfiguration="false" />      <handlers>       <remove name="blockviewhandler"/>       <add name="blockviewhandler" path="*" verb="*" precondition="integratedmode" type="system.web.httpnotfoundhandler" />     </handlers>   </system.webserver> </configuration> 
  7. inside c:\myapplication\global.asax:

    <%@ application language="c#" %> <%@ import namespace="system.web.mvc" %> <%@ import namespace="system.web.routing" %> <script runat="server">  static void registerroutes(routecollection routes) {     routes.ignoreroute("{resource}.axd/{*pathinfo}");      routes.maproute(         "default",         "{controller}/{action}/{id}",         new { controller = "home", action = "index", id = urlparameter.optional }     ); }  void application_start() {     registerroutes(routetable.routes); } </script> 
  8. inside c:\myapplication\views\home\index.cshtml:

    <!doctype html> <html> <head>     <meta charset="utf-8" />     <title></title> </head>  <body>     hello word </body> </html> 
  9. now have necessary files asp.net mvc 3 application. final step host on web server , run it.


conclusion: unless suffering severe brain damage never , download visual studio 2010 express , start developping asp.net mvc 3 applications following tutorials on asp.net mvc web site.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -