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. It seems that we can't download anymore the assemblies. Is it possible to have the project compiled on the fly ( I mean without compiling the my web application but letting IIS doing so , it is possible to achieve this with the regular asp.net so I assume it could be possible with the MVC framework)
Thx Dave
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.
Yes we can create an solution without Visual studio. But need the following things. Get the template for the asp.net application or you can create by own, but need to modify the project file.
To run the application without opening Visual Studio, You need to install IIS (as rtpHarry has suggested). Then You need to have your application in a virtual directory. To create virtual directory perform following steps: Type inetmgr at command prompt -> Click OK.
Sure, it's pretty easy, only a couple of steps after you install ASP.NET MVC 3.
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(); } } }
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
Create a folder c:\MyApplication
c:\MyApplication\bin
and copy MyApplication.dll
to this bin
folder.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>
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>
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>
Inside c:\MyApplication\Views\Home\Index.cshtml
:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> </head> <body> Hello Word </body> </html>
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With