Click here to Skip to main content
13,550,059 members
Click here to Skip to main content
Add your own
alternative version


49 bookmarked
Posted 11 Jul 2005

How to get Intellisense for Web.config and App.config in Visual Studio .NET

, 11 Jul 2005
Rate this:
Please Sign up or sign in to vote.
This article provides a schema definition for .NET config files that allows Visual Studio .NET to display intellisense.


Web.config and App.config have can have many different configuration options but it is difficult to remember what some of the less commonly used options are. This article provides a schema definition for .NET configuration files such as Web.config and App.config. The schema makes Visual Studio .NET help you out by displaying intellisense when working in these files.

Extend Visual Studio .NET with XML Schema

Visual Studio .NET has an extensible model that provides intellisense in XML and HTML-based documents based on XML schema. To get intellisense for Web.config or App.config I created a schema for the .NET configuration files and and put the schema into a folder under the Visual Studio .NET installation.

Visual Studio .NET then reads the schema file and lists the schema in the targetNamespace drop-down list when editing the properties of the document. Selecting the schema from the list adds the xmlns attribute to the root element of the document.


There is a problem with this method that you need to be aware of. To get intellisense in Visual Studio .NET, the xmlns attribute is added to the root element of the document so that Visual Studio .NET knows which schema to use for the document.

ASP.NET and Winforms applications will throw a runtime error if the <configuration> element in web.config or app.config has the xmlns attribute when you run your application. e.g. This will give an error.

<configuration xmlns="SchemaForWebConfig">

You must remember to remove the xmlns attribute when you are finished using intellisense in your config file. If you do not, you will get an error in your application!

How to install

  1. Download the file from the link above
  2. For Visual Studio .NET 2002 unzip the contents of the zip file into
    C:\Program Files\Microsoft Visual Studio .NET\Common7\Packages\<BR>schemas\xml
  3. For Visual Studio .NET 2003 unzip the contents of the zip file into
    C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\<BR>schemas\xml
  4. Open Web.config or App.config in Visual Studio .NET
  5. View the properties for the document
  6. Select .NET Configuration File from the list for the targetSchema property

  7. Edit Web.config or App.config

  8. Remember to remove the xmlns attribute from the <configuration> element when you have finished editing your Web.config file!

More Information on Visual Studio .NET Schema Annotations

This topic is covered in more depth in the MSDN article Visual Studio .NET Schema Annotations.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Australia Australia
No Biography provided

You may also be interested in...

Comments and Discussions

Generalsimply awesome Pin
imsathy23-Mar-06 1:56
memberimsathy23-Mar-06 1:56 
GeneralGreat work Pin
Nay Ko Oo19-Oct-05 21:06
memberNay Ko Oo19-Oct-05 21:06 
GeneralNice tip Pin
Bruno Capuano21-Jul-05 20:39
memberBruno Capuano21-Jul-05 20:39 
GeneralNice Article Pin
Javier Lozano11-Jul-05 10:13
memberJavier Lozano11-Jul-05 10:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180515.1 | Last Updated 11 Jul 2005
Article Copyright 2005 by RossDonald
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid