default heading

 

ASP.NET 2.0 (III) Architecture and Tools...

This article is the third in a series. In this third article we'll take a look at the changes to the architecture of ASP.NET v2.0. In particular we'll look at the changes to the compilation and deployment model.


By: Chris Sully Spacer Date: January 22, 2006Spacer Spacer Spacer Printer Friendly Version

Introduction

In this third article we'll take a look at the changes to the architecture of ASP.NET v2.0. In particular we'll look at the changes to the compilation and deployment model. We'll also take a quick look at the tool support provided by Visual Studio .NET 2005. In subsequent articles we'll then look in more detail at areas introduced in the first 3 articles and get into a little more code than these first three overviews have allowed.

Note that the information presented is based on the Beta product so minor changes may have been introduced in the final product release.

Compilation and Deployment

ASP.NET v2.0 provides automatic compilation for satellite code via a code directory. All files within this directory will be compiled on the first run. Files therein can include WSDL and XSD files, for example, as well as .vb and other ‘pure code’ files.

Also provided is pre-compilation of the entire web site, including web pages. This both improves start up performance and protects intellectual property.

Note that instead of the content page inheriting from the code behind page, we now specify which code behind page is to be compiled with the content file. This is actually a fundamental change at the CLR level. Version 2.0 of the CLR provides support for partial classes, where the same class can span multiple files. This allows the code separation page to be simpler as it can be part of the same page as the content page, meaning protected variables are not required to reference the controls on the page and the Designer does not need to write code into the code behind file.

A few new keywords are introduced with these changes: Partial to designate code is part of a class. For the aspx the compileWith attribute defines the physical file containing the code to compile along with the aspx.

ASP.NET 1.x already supports dynamic compilation of aspx and ascx files, eliminating the need for a specific compilation step. Other files required manual/ tool driven compilation however. ASP.NET 2.0 extends this model to other files: classes, Web Services, typed data sets, master pages, resource files and themes. To do so the developer must use specific reserved folders:

  • \Code: for class files (e.g. .vb) , WSDL (.wsdl), and typed datasets (.xsd).
  • \Resources and \LocalResources (.resx and .resources)
  • \Themes (.skin)
  • \Data – personalisation database

There is no restriction on creating sub-directories within these folders to organize your code.

The assemblies created are not placed in the \bin directory – there is no need for the \bin though it can still be used for scenarios where dynamic compilation is not required or supported. Automatically compiled assemblies are placed in a folder managed by ASP.NET.

The dynamic compilation system is configurable via web.config. Further the build process itself is extensible.

Applications can be precompiled. In place pre-compilation is achieved via:

http://applicationDirectory/precompile.axd

This precompiles (changed) files. Errors that occur in pre-compilation will halt the entire process. The errors appear in the browser window exactly as if the page had been hit.

To deploy the application without source the aspnet_compiler.exe tool is provided. Such precompilation does not compile static files such as HTML, web.config, XML, etc. These are just copied to the target directory. As are the contents of the /bin directory.

If any changes are required to the target application the process must be initiated again.

There is a compilation API – ClientBuildManager – which allows custom tools to be built to manage the build process.

Development Tools

With ASP.NET 2.0 comes Visual Studio.NET 2005 which has been particularly improved for the web developer. There is also a stand alone development tool targeted specifically at web developers (think web matrix): Visual Web Developer Express Edition. Basically the latter is aimed at those who don’t want to pay for the full Visual Studio product.

Among the new features/ changes to VS.NET are:

  • Project files are a thing of the past – you simply open files from their location. This makes team development simpler – with multiple people editing multiple files the project file can easily be locked by another person. Further, a project-less system makes life easier if you wish to use development tools other than VS.NET.
  • Support for both inline code and an improved code-behind model allow better cross-tool support.
  • Visual inheritance with master pages eases site design. VS 2005 supports the new model of master pages – it allows creation of master pages and the linking of standard pages to this master and shows the visual inheritance of the master. It enforces the edit restrictions imposed on the child page by the master.
  • Full intellisense in HTML and code views enables quicker code development.
  • Support for accessibility; VS.Net checks to ensure web sites conform to regulations for accessibility like section 508 and web content accessibility guidelines.
  • Improved designer surface, supporting the enhanced web control designer framework. Context sensitivity has been increased giving greater 'discoverability' for the features of a control. Controls consistently have an icon selection of which presents a task panel of related possible tasks for selection.
  • A built in web server allows development and testing without IIS and without administrator privileges.
  • Support for the Web Site Administration Tool: this is accessible via the Website menu – ASP.NET Configuration. See a later article for more on this tool. Also accessible via this menu is an enhanced Copy Web Site facility.

There are also the following more minor changes:

  • Solution explorer: has been simplified
  • Toolbox: is similar but the number of tabs extended to cater for the increased number of types of controls supported, i.e. web, data, validation, navigation, login, web parts and HTML.
  • Design view: defaults to flow layout as it should have in the previous version; you also have tabs to change the view of the page between source and HTML. This is like Web Matrix. You also have links to areas within the hierarchy of the page. Also the toolbox is not disabled in design view so none of the switching the view to perform such tasks. Allied to this is selection preservation between views, which should also have previously been present.
  • Starter kits provided to speed development

Note that the Visual web developer express edition does not include the following:

  • accessibility checker
  • source code control integration
  • pre-compilation and MSI deployment
  • extensibility such as add-ins, macros and VSIP
  • remote data
  • full featured server explorer
  • class designer
  • XSLT debugging
  • remote debugging
  • windows forms
  • class library creation

Most of which will not be great issues the majority of the time.

Summary

In this article we've looked at the architectural changes new to ASP.NET 2.0 in overview as well as the changes in Visual Studio. In the next article we'll start looking in more depth at ASP.NET 2.0 considering data source controls and data binding.

References

ASP.NET v2.0 – the Beta Version
Homer et al.
Addison-Wesley

 
 
 
 
   © Copyright 2002-2012 DotNetJohn.com LLC
Terms of Use Privacy Policy