BusinessRx Community

Dedicated to the advancement of software, technology and the people who devote their lives to it.

Welcome to BusinessRx Community Sign in | Join | Help
in Search

BusinessRx Reading List

These blog entries are written by industry experts and leaders. We consider this content to be a good read for any software developer or web technologist.

Browse by Tags

All Tags » Tips and Tricks » Community News » ASP.NET   (RSS)

  • Tip/Trick: Automating Dev, QA, Staging, and Production Web.Config Settings with VS 2005

    One of the questions I get asked fairly regularly is: "how can I can easily change different configuration settings in my web.config file based on whether my application is in a dev, qa, staging or production mode?"  The most common scenario for this is one where an application uses different database connection-strings for testing and production purposes.

    It turns out you can easily automate this configuration process within the Visual Studio build environment (and do so in a way that works both within the IDE, as well as with command-line/automated builds).  Below are the high-level steps you take to do this.  They work with both VS 2005 and VS 2008.

    1. Use ASP.NET Web Application Projects (which have MSBuild based project files)
    2. Open the VS Configuration Manager and create new "Dev", "QA", "Staging" build configurations for your project and solution
    3. Add new "web.config.dev", "web.config.qa", and "web.config.staging" files in your project and customize them to contain the app's mode specific configuration settings
    4. Add a new "pre-build event" command to your project file that can automatically copy over the web.config file in your project with the appropriate mode specific version each time you build the project (for example: if your solution was in the "Dev" configuration, it would copy the web.config.dev settings to the main web.config file).

    Once you follow these steps, you can then just pick the mode your solution is in using the configuration drop-down in the VS standard toolbar:

    The next time you build/run after changing the configuration mode, VS will automatically modify your application's web.config file to pick up and use the web.config settings specific to that build configuration (so if you select QA it will use the QA settings, if you select Deploy it will use the Deploy settings).

    The benefit with this approach is that it works well in a source control environment (everyone can sync and build locally without having to make any manual changes on their local machines).  It also works on a build server - including with scenarios where you are doing automated command-line solution builds.

    To learn more about the exact steps to set this up, please read the Managing Multiple Configuration File Environments with Pre-Build Events post that Scott Hanselman published earlier tonight.  Also check out my ASP.NET Tips, Tricks, and Gotchas page for other ASP.NET Tips/Tricks recommendations.

    Hope this helps,

    Scott

  • ASP.NET 2.0 Tips and Tricks and ASP.NET, IIS7 and ASP.NET AJAX End to End Talks

    I've finished my whirlwind speaking tour of Europe (Belgium, UK and Netherlands in less than one week), and was fortunate to have had the chance to present to several hundred people along the way.  Many thanks to everyone who came out to attend my talks!

    Here are the first two slide decks + samples from the talks I gave:

    ASP.NET Tips and Tricks: 

    This talk covered ASP.NET UI, AJAX, Caching and Deployment Tips and Tricks, and Visual Studio 2005 tips/tricks.  The samples include updated versions of ASP.NET AJAX that all work with ASP.NET AJAX 1.0.  You can download the slides+samples here.

    You can learn more about the Visual Studio build performance optimization suggestions by reading this past post of mine on improving build performance.  You can also find several dozen more ASP.NET and Visual Studio Tips/Tricks of mine on my Tips and Tricks summary page.

    Building an End-to-end Web Application from scratch using ASP.NET 2.0, ASP.NET AJAX, IIS7 and Visual Studio:

    This talk walked through building a rich data-driven application from scratch using ASP.NET 2.0, ASP.NET AJAX 1.0, IIS7 and Visual Studio (all of which are now officially shipping products).  You can download the deck + completed sample here.

    This talk demonstrates the following features: IIS7 distributed configuration, Master Pages, Building a DAL using DataSets, Building Data Driven Edit Pages, Building Catalogue Browsing Pages, Site Navigation, Url Rewriting, Site Navigation, CSS Control Adapters, ASP.NET AJAX, ASP.NET AJAX Control Toolkit, Membership/Roles, IIS7 Admin UI, SQL Cache Invalidation, and WebPart portal support.

    Hope this helps,

    Scott

    P.S. I'll be posting more slides+samples from my other talks in the days ahead (including my Orcas and WPF/E talks).

  • ASP.NET Tips and Tricks and LINQ Slides/Demos from CodeMash

    Below are the slides + demos for the two breakout talks I presented this past Friday at the CodeMash conference:

    ASP.NET 2.0 Tips and Tricks

    This talk covered ASP.NET UI, AJAX, Caching and Deployment Tips and Tricks, and Visual Studio 2005 tips/tricks.  Click here to download the slides+demos for this talk.

    You can learn more about the Visual Studio build performance optimization suggestions by reading this past post of mine on improving build performance.  You can also find several dozen more ASP.NET and Visual Studio Tips/Tricks of mine on my Tips and Tricks summary page.

    Building Data Driven Web Applications using LINQ

    This talk provided a drill down of LINQ (which will ship later this year), and demonstrated some of the dramatic productivity improvements it will bring for ASP.NET.  Click here to download the slides+demos for this talk.

    You can learn more about LINQ and how to use it with ASP.NET by reviewing some of my past LINQ posts.  Here are a few in particular worth reviewing:

    Thanks again to everyone who attended my talks - I really had a great time and hope you did too! 

    Scott

    P.S. I will also be posting the slides + demos from my LINQ keynote at the CodeMash event shortly.

Powered by Community Server, by Telligent Systems
'