CSharp Certification, Development, and Training | Recent changes | View source | Page history

Printable version | Disclaimers | Privacy policy

Not logged in
Log in | Help
 

Visual Studio Web Applications—Visual Studio 2005 Web Projects

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

Visual Studio 2005 Web Application Projects

Although the response to Visual Studio’s projectless development model has been overwhelmingly positive, a significant minority of developers didn’t like the change. Their criticisms generally emphasized a few common themes:

  • The change in the code model has created an unnecessarily difficult migration process for older Visual Studio projects. Also, some unusual application designs are known to cause problems in migration. (One example is if you’ve created several separated projects and placed them in subdirectories of the same virtual directory. In this case, the projects are kept separate for development purposes but are in essence the same application for deployment. With projectless development, it’s difficult to keep the files in these subdirectories separate.)
  • The project development system is stricter than projectless development. That’s because the project file explicitly lists what files should be part of the project, so missing files are always noticed and extra files in the same directory are never included. The project file also works with the MSBuild utility, which allows project compilation to be automated and customized.
  • Project-based websites are easier to deploy. (This isn’t necessarily true—in fact, ASP.NET 2.0 provides a wide range of deployment options, as you’ll learn about in Chapter 18.) However, some people preferred the Visual Studio .NET 2003 deployment approach, which always precompiles your code into a single assembly file.

All in all, if you have a significant investment in the Visual Studio .NET 2003 project model (for example, you’ve developed a custom MSBuild extension, you have a highly automated deployment process in place, or you’re migrating a complex project with subapplications), you don’t need to change everything to use ASP.NET 2.0. Instead, you can use the "classic" Visual Studio .NET 2003 project model in Visual Studio 2005. You’ll still be able to take advantage of Visual Studio’s new features (such as its integrated web server). All you need to do is download a separate add-in called Visual Studio 2005 Web Application Projects. It’s likely that this component will be included in a future Visual Studio service pack.

To install this component, surf to http://msdn.microsoft.com/asp.net/reference/infrastructure. You’ll see the download for Visual Studio 2005 Web Application Projects on this page, along with several articles and another link to download Visual Studio 2005 Web Deployment Projects (a separate feature for deployment you’ll consider in Chapter 18).

Once you’ve installed the project support, you have two options to create a new web application. You can use the normal File > New Web Site command to create a projectless web application, or you can use File > New Project to create a web project. You’ll find the familiar ASP.NET Web Application option, as shown in Figure 2-31.


Image:7680f0231.jpg
Figure 2-31. The return of the web project


The newly generated project uses a code model that’s more similar to Visual Studio .NET 2003, with all events wired up using delegate code (instead of automatic event wireup). You’ll also be able to view (and edit) both the code-behind file and the automatically generated file that has the web control declarations. This partial class is stored in a file with the extension .aspx.desginer.cs. This means if you create a page named Default.aspx, you’ll end up with a code-behind class in a file named Default.aspx.cs and control declaration in a file named Default.aspx.designer.cs (see Figure 2-32). At compile time, these two files will be merged.


Image:7680f0232.jpg
Figure 2-32. The designer file with control declarations



Note The code file with the control declarations isn’t available in a projectless web application. Instead, it’s generated behind the scenes the first time the application is compiled and executed (as shown in Figure 2-22). As a result, you never have the chance to view this code.



Previous_Page_.gif Next_Page_.gif

Retrieved from "http://en.csharp-online.net/Visual_Studio_Web_Applications%E2%80%94Visual_Studio_2005_Web_Projects"

Accessed: 2,698 times Modified: 00:08, 15 February 2007. © CSharp-Online.NET


[CSharp Certification, Development, and Training]
C# Certification, Development, and Training (Home)
ASP.NET
C# and Visual C#
C# .NET Articles
C# .NET Glossary
C# .NET Resources
C# .NET Reviews
C# .NET Tutorials
C# .NET Videos
Microsoft .NET Framework
Microsoft Visual Studio .NET

View source
Discuss this page
Page history
What links here
Related changes

Special pages
Bug reports