DOCX

Web Development in Visual Studio 2010

By Adam Lawrence,2014-06-25 20:14
11 views 0
Web Development in Visual Studio 2010

Hands-On Lab

    Web Development in Visual Studio 2010

Lab version: 1.0.0

Last updated: 6/25/2012

    Page 1

CONTENTS

    OVERVIEW ............................................................................................................................................. 3

    EXERCISE 1: USING HTML CODE SNIPPETS IN VISUAL STUDIO 2010 ............................................. 6

    Task 1 Adding a New ListView to an HTML Page Using an HTML Code Snippet .............................. 6

    Task 2 Creating a Custom HTML Snippet ..................................................................................... 10 Exercise 1: Verification 16

    EXERCISE 2: TRANSFORMING A WEB.CONFIG FILE FOR DEPLOYMENT ...................................... 19

    Task 1 Creating a Staging Configuration in Visual Studio 2010 ..................................................... 19

    Task 2 Adding Code to Populate Text Value of EnvName from a Value in the web.config ............ 22

    Task 3 Adding a Logging Database Connection String to the web.config File ................................ 24

    Task 4 Writing a Transform to Change the Environment and Logging Connection Strings in the

    Staging web.config ......................................................................................................................... 25

    Task 5 Generating a Transformed web.config File from the Command Line ................................. 26

    Task 6 Generating a Transformed web.config File from Visual Studio .......................................... 28 Exercise 2: Verification 31

    EXERCISE 3: PACKAGING AND DEPLOYING WEB APPLICATIONS FOR THE VISUAL STUDIO

    DEVELOPMENT WEB SERVER ........................................................................................................... 32

    Task 1 Opening the Project Properties Publish Page and Creating a Package. .............................. 32

    Task 2 Preparing the Web Server for Deployment ....................................................................... 34

    Task 3 Deploying the Package ..................................................................................................... 36

    Exercise 3: Verification 41

    EXERCISE 4: PACKAGING AND DEPLOYING WEB APPLICATIONS FOR INTERNET INFORMATION

    SERVER (IIS) ........................................................................................................................................ 42

    Task 1 Opening and the Project Properties Publish Page, Setting the Web Aplication to Use IIS and

    Create a Package. .......................................................................................................................... 43

    Task 2 Deploying the Package ...................................................................................................... 45

    Exercise 4: Verification 50

    SUMMARY ............................................................................................................................................ 51

    Page 2

Overview

    Microsoft Visual Studio 2010 offers many new features for development of ASP.NET web applications. The goal of these new features is to aid developers in creating and deploying high quality and fully featured web applications quickly and easily.

    Visual Studio 2010 now supports HTML code snippets. Snippets are a great way to generate high-quality code. There are many snippets that come with Visual Studio, and developers have the ability to create their own.

    Another new feature which Visual Studio 2010 provides is the ability to transform the web.config file for deployment. Visual Studio 2010 supports a rich configuration transformation language that allows developers to change elements in the web.config file including connection string, file path locations, and service addresses.

    Deployment of ASP.NET web applications is now easier due to new packaging and deployment features in Visual Studio 2010. Now web applications can be easily published to a specific location on the build machine (or even to a ZIP file) and easily deploy to either the Visual Studio Web Server or Windows Internet Information Server (IIS).

    Objectives

    In this Hands-On Lab, you will learn how to:

    ; Use HTML code snippets to aid in development of ASP.NET web application pages

    ; Create and deploy your own custom HTML code snippets

    ; Create and automatically transform the web.config as the web application is deployed across

    environments.

    ; Create a deployment package for your ASP.NET web application and deploy the application to

    either the Visual Studio Development web server or Windows Internet Information Server (IIS).

Exercises

    This Hands-On Lab is comprised by the following exercises:

    ; Using HTML Code Snippets in Visual Studio 2010

    ; Transforming a web.config file for deployment

    Page 3

    ; Packaging and deploying a web application to the Visual Studio Development Web Server

    ; Packaging and deploying a web application to the Windows Internet Information Server (IIS)

Estimated time to complete this lab: 60 minutes.

    System Requirements

    You must have the following items to complete this lab:

    ; Microsoft Visual Studio 2010 Beta 2

    ; IIS 7.0

Setup

    All the requisites for this lab are verified using the Configuration Wizard. To make sure that everything is

    correctly configured, follow these steps.

    Note: To perform the setup steps you need to run the scripts in a command window with administrator privileges.

    1. Run the Configuration Wizard for the Training Kit if you have not done it previously. To do this,

    run the CheckDependencies.cmd script located under

    the %TrainingKitInstallationFolder%\Labs\WebDevelopment\Setup folder. Install any pre-

    requisites that are missing (rescanning if necessary) and complete the wizard.

Starting Materials

    This Hands-On Lab includes the following starting materials.

    ; Visual Studio solutions: The exercise provides a Visual Studio solution that you can use as

    starting point for the lab exercise. You will find the starting point

    at: %TrainingKitInstallFolder%\Labs\WebDevelopment\Source\Ex01-

    HTMLCodeSnippets\begin\C#\HTMLLab

    ? HTMLLab.sln: A solution containing a simple web application used as a starting point for

    Exercise 1 and the subsequent exercises.

    Page 4

    Note: For each exercise, there is an End folder which contains the resulting solution

    you should obtain after completing that exercise.

    Note: User will perform appropriate name value replacement in all path references containing

     tag.

    Note: To verify that each step is correctly performed, it is recommended that you build the