Visual Studio Web Applications
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:Articles |
| Visual Studio Articles |
|
Visual Studio Web Apps |
| © 2006 M. MacDonald, M. Szpuszta |
| This article—Visual Studio Web Applications—is from Pro ASP.NET 2.0 in C# 2005, by Matthew MacDonald, Mario Szpuszta. Copyright © 2006 Matthew MacDonald, Mario Szpuszta. All rights reserved. Reproduced by permission. This article has been edited especially for C# Online.NET. Read the book review! |
|
Visual Studio 2005
With ASP.NET, you have several choices for developing web applications. If you’re inclined (and don’t mind the work), you can code every web page and class by hand using a bare-bones text editor. This approach is appealingly straightforward but tedious and error-prone for anything other than a simple page. Professional ASP.NET developers rarely go this route.
Instead, almost all large-scale ASP.NET websites are built using Visual Studio. This professional development tool supports a rich set of design tools, including a legendary set of debugging tools and IntelliSense, which catches errors and offers suggestions as you type. Visual Studio also supports the robust code-behind model, which separates the .NET code you write from the web-page markup tags. To seal the deal, Visual Studio 2005 adds a built-in test web server that makes debugging Web sites easy and hassle free.
In this chapter, you’ll tour the Visual Studio IDE (Integrated Development Environment) and explore its key features. You’ll also learn about the code model used for ASP.NET 2.0 web pages, and you’ll take a look at two helpful add-ins: Visual Studio 2005 Web Application Projects and the ASP.NET Development Helper.
Note Visual Studio 2005 is available in several versions. This chapter assumes you are using the full Visual Studio 2005 Professional or Visual Studio 2005 Team System. If you are using the scaled-down Visual Web Developer 2005 Express Edition, you will lose some features. Most notably, you won’t be able to create separate components using class library projects.
| VISUAL STUDIO 2005 CHANGES |
If you’re a seasoned ASP.NET developer, you’re most interested in what’s new in Visual Studio 2005. Although most of the editing features and debugging tools in Visual Studio 2005 are the same as those in Visual Studio 2003, the underlying model has a few significant changes. Here are the four most significant changes, all of which you’ll learn more about in this chapter:
- Projectless development: Visual Studio no longer clutters your web projects with extra development files (such as .csproj and .sln). One obvious benefit of this model is that you can deploy exactly what you develop, without needing to filter out just a subset of the files. However, as you’ll see in this chapter, the concept of projectless development is slightly overstated. Visual Studio still stores some information in a solution file (such as breakpoints and build settings), and it quietly stows that file away under a user-specific directory. However, there’s a significant difference—these hidden solution files aren’t required. Essential details (such as project references) are stored right in the web.config file. You’ll learn about projectless development in the "Websites in Visual Studio" section of this chapter.
- New compilation model: Visual Studio is no longer responsible for compiling your code. Instead, ASP.NET takes on that responsibility exclusively. This gives Visual Studio more flexible debugging, and it simplifies deployment on different platforms (for example, 32-bit and 64-bit Windows). It also allows you to combine web pages written in C# with web pages written in another .NET language (such as Visual Basic) in the same project.
- New code model: The shift in the compilation model also reduces the differences between the code-behind model and the code-inline model of writing web pages, both of which Visual Studio now supports. However, the syntax for code-behind is subtly different from that used for Visual Studio 2003 web pages, and you’ll need to perform a one-way conversion operation to edit your web application in Visual Studio 2005. You’ll learn about the code model in section "The Code Model" later in this chapter.
- Integrated test web server: If you’ve programmed with Web Matrix (a scaled-down design tool used with ASP.NET 1.x), you’ll recognize the new integrated web server, which allows you to run your web pages without setting up virtual directories or deploying your website.
Along with these changes, a new edition of Visual Studio, called Visual Studio 2005 Team System, adds advanced collaboration and code versioning support (which is far beyond that available in simpler tools such as Visual SourceSafe). Although Visual Studio Team System isn’t discussed in this chapter, you can learn more from http://lab.msdn.microsoft.com/teamsystem or Pro Visual Studio 2005 Team System (Apress, 2005).
Another interesting new tool is the freely downloadable ASP.NET Development Helper, which gives you the ability to see view state, tracing, and caching information in your web browser. You’ll learn about the ASP.NET Development Helper in the "ASP.NET Development Helper" section.
|


