You are on page 1of 5
CMPTER 2 = INSTALLING AS@NET MVC & Using the Stand-alone Installer [you choose not to use the Web Platform Installer to install ASPNET MVC 4, your other option with Visual Studio 2010 {either Express or another version) isto use the stand-alone installer ‘As described earlier in the chapter, the stand-alone installer is an executable Ble that you download from hetp://bst. ly/DownoadiWVC4, shown in Figure 2-6. The advantage of the installer file is that truns offline, so after ‘you download the ile, you can disconnect from the Internet (ifyou need to) and share the file using any offline ‘method, such as USB keys. BE racrosott Soin Download Center a idio 2010 SP1 and Visual 2 ASP.NET MVC 4 for Visual St Web Developer 2010 SP1 uictnes ASP.NET MAC 4 provides & Modll-Visw-Controllr (MV) framewor for developing sae Web applications using Veua Studio 2010 SP? or Viual Web Developer 2 Quick details Otcherane [Bg Looking for support? O) textenseost © Sesto Figure2-6. Download page forthe stand-alone installer ‘After you download the file, just double-click it and it will un, as shown in Figure 2-7. The process is really simple. Select the “I agree tothe license terms and conditions” check box o enable the Install button. Click the “instal” button, and the program handles all the installation tasks, When it finishes, it prompts you to ext 16 ‘HAPTER 2 = INSTALLING ASP.NET NC 4 Microsoft ASP.NET MVC 4 NET 00h oF ch are nuded blows + Moos ASP.NET Model View centres Mrosft ASPET Web Pages 2 net eases Mires Package Manager Microsoft ASPET Universal Proiders iat) [Geen Figure 2.7. The license agreement page ofthe stand-alone installer Installing ASP.NET MVC 4 Server Components Let's look now atthe server that will host the application once we finish the development. Just as we needed to install ASPNET MVC 4 on the development machine in order to develop applications, we need to install ton the server so thatitean host the applications. In the server you also use one ofthe two available methods to install ASPNET MVC 4, the stand-alone installer o: Web PI. Installing ASPNET MVC 4 on a server is different fom installing ton your development machine in the sense that the stand-alone installer (or WebP?) will skip instalation of the development tools, recognizing that you're installing iton a server and that the operating system is different (e.., Windows Server 2012). By making this distinction and skipping unnecessary components the server ends up having only the components that it needs to host and serve ASPNET MVC. applications. ‘An additional advantage of installing ASPNET MVC 4 on the server is thatthe requited assemblies are registered in the Global Assembly Cache (GAC), which means that any web site that runs on ASP.NET MVC 4 in that server now hhas the required assemblies avallable because the GAC works as a repository of assemblies for the whole server, not Just for individual applications ‘The limited component installation is also important for security and performance considerations, because administrators don’t want any unnecessary software on the servers—and definitely don't want development tools on the server. The problem with installing development tools on the server is that they sometimes open network ports and or enable services that otherwise will be closed or turned off, and that increases the risks of security breaches and performance problems. Visual Studio Application Templates After you have installed ASPNET MVC 4 to work with Visual Studio 2010, or have installed Visual Studio 2012 (which alzeady includes ASP.NET MVC 4), you can start creating new ASP.NET MVC. projects ‘To start creating & new project, open Visual Studio (2010, 2012, or Express) and choose FILE > New Project, 4s shown in Figure 2-8. Alternatively, you can use the keyboard shortcut Ctri+ShifteN, v CMPTER 2 = INSTALLING AS@NET MVC & 04) sor Page wiroon Vii Stoo 1D New ret cobs Were sean TE New Team Figure 2-8, Creating « new project in Viswal Studio 2012 This option opens the New Project dialog, shown in Figure 2-9, which is divided into four sections, The ;navigation pane on the left allows you to navigate through the available project templates, either online or installed {in your computer. As shown in Figuze 2-8, expand the navigation pane to Installed ® Templates ® Visual C#, That instructs Visual Studio to display from the set of installed project templates all those that are preconfigured to work ‘with the Visual C# language. As you can see, Visual Studio can be used to build all kinds of diferent projects under the Visual C# node. We're going to be creating a web application, so select Web. Nemes ~ Set et = 2 Bh emrenegeae venice We Vic BA] snncr wether ssn vou Se Cy wouracrmns = es Figure 29, The New Project dialog ‘The middle section displays all the different types of Web project templates available for Visual Ce. Select the ASP.NET MVC 4 Web Application template, as shown in Figure 2:9. 8 ‘HAPTER 2 = INSTALLING ASP.NET NC 4 Note _In Visual Studi, the term “solution” refers to the collection of individual projets that compose the application you are building, You will see in @ moment how an ASPNNET MVC 4 application can have two projects, one for the web application and one for unt tess. In the drop-down list boxes atthe top ofthe middle section ofthe dialog, you can select the version of NET Framework to work with and how thelist of templates should be sorted, For the samples in the book, we will use NET Framework 45. ‘The section on the right side of the dialog provides a brief description of he template selected inthe middle section, Abave that description isa search box, enabling you to search for a specific installed template. {At the bottom of the dialog, you type the name of your application and specify the directory where Visual Studio will save the soludion files. To the right are wo checkboxes: + Create directory for solution: Selecting this instructs Visual Studio to create a separate directory {or the solution files. + Ada to source control: Selecting this will add your application to a source-control system. 1 strongly suggest keeping all solution files in e separate folder, so select the “Create directory for solution” checkbox (ifitisn't already selected). As fr the source control checkbox, if you already use a source-contro system, you can use it (as long as itis compatible with Visual Studio). Note Several commercial and tree source-contol systems are available. Ifyou don't have a source-cantol system, You are missing a great technology that can save you from unwanted fle/code deletions, team collaboration issues, and so forth, Microsoft has its own product, called Microsoft Team Foundation Server, which gives you not only source control but other features as well, such as continuous unt testing, code review, team collaboration, agile planning, and more. Microsoft also offers a cloud-based service, named Team Foundation Service (at http://¢s.visualstudio. con), You can sign up for free and get an account for up to five developers. ‘Alter you have filled in all the necessary information in the New Project dialog, click the “OK" button, The New ASPNET MVC 4 Project dialog is displayed (see Figure 2-10), which gives you three important options: choose the ASPNET MVC 4 project template for your new project, choose a view engine, and choose whether to create a unit test project ornot. Each option is discussed in turn next 19 CMPTER 2 = INSTALLING AS@NET MVC & eet © canesunttatpoeet ehcgptentan Figure 2-10, NewASPNETMVC4 Project dialog Choose the Project Template ‘You can choose the ASP.NET MVC 4 project template from one ofthe following eight avalable options. Bach of the templates serves a specific purpose depending on what kind of project you are building, + Empty: This template creates a solution and project with only the references and minimum, configuration to start building an ASP.NET MVC 4 application from seratch. Only the directory structure is added, Te does not create any controllers, views, of functionality. + Basi: Similar to the Empty template, the Basic template has a minimum configuration, but it adds some shared views for an initial (very) basic layout but stil no controllers aze added and rng default functionality implemented, + Internet Application: This template creates an entire working website that implements anicely done HTMLS-based layout with CSS files, jQuery, and some plug-ins already setup. Ithas Forms Authentication implemented in the Account contzoller for handling users with the ASPET Membership system, This template is intended for public facing applications, enabling "users to be authenticated using either username and password or OAuth with Facebook, Google, or Twiter. + intranet Application: This template is similar to the Internet Application template but, {instead of implementing Forms Authentication, i(uzes Windows Authentication. Windows ‘Authentication is used here because normally intranet users are authenticated against an ‘Active Directory domain, 20

You might also like