Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio
All postings are provided AS IS with no warranties, and confer no rights. Additionally, views expressed herein are my own and not those of my employer, Microsoft.
I've finally gotten some time to experiment with some of the features of the Visual Studio 2005 IDE (as you can see from my post last week about how to populate the Add References dialog). I wanted to share a couple of tricks I discovered about using Visual Studio 2005 to create and edit XML that I found pretty useful, but for which the documentation was either vague or lacking (in my opinion).
I have been trying to install or register an XSD file so that Visual Studio 2005 can find it and automatically use it when I am editing specific types of XML documents in the IDE. Initially, I expected that there would be a simple registry-based solution to associate new XSDs like there is for populating folders with assemblies into the Add References dialog. After some research, I couldn't find a way to do this so I began looking for what kind of other options are available.
I found an MSDN document that describes what is new in code editing in VS 2005. This document describes some of the features of the new XML editor in the IDE. I was specifically interested in "Flexible schema association" and "XSD-based IntelliSense" so I tried to find more information about these topics. I ended up finding this topic about the schema cache. Based on this document, I was able to get the following mechanisms to work to cause Visual Studio 2005 to recognize my XSD:
Option 1 - copy the XSD into the Visual Studio 2005 schemas directory
I also decided to associate a file extension for my file type with Visual Studio 2005. If you are using a well-known file extension you may not need to use these additional steps.
This option worked fine for me, but required that I copy my XSD into the Visual Studio 2005 schemas directory.
Option 2 - modify the Visual Studio 2005 schemas catalog.xml file
Because I also wanted to associate a file extension for my file type with Visual Studio 2005, I added this line to catalog.xml as well. If you are using a well-known file extension you may not need to add this additional entry.
<Association extension="(your extension)" schema="(path to your XSD file)"/>
This option allowed me to store my XSD file in whatever location I wanted to, but had the drawback of requiring me to edit one of the configuration files that ships with Visual Studio 2005.
Option 3 - add a new XML file to the Visual Studio 2005 schemas directory
I could not find this option documented on MSDN, but I discovered it by asking some questions of the team that developed the XML Editor features in Visual Studio 2005. I wanted to be able to register my schema without requiring my XSD file to be in the central Visual Studio 2005 schemas directory and without requiring any modifications to the catalog.xml file that shipped with Visual Studio 2005. I found out that Visual Studio 2005 will parse files named *.xml in %ProgramFiles%\Microsoft Visual Studio 8\XML\Schemas and look for additional schema registration, even if the file is not named catalog.xml.
So in this option, I did the following:
This option allowed me to store my XSD file in whatever location I wanted to, and it did not require me to to edit one of the configuration files that ships with Visual Studio 2005. This is the option I ended up choosing for my scenario.
Additional notes
A few other notes about this process that I found while trying to figure this out:
Also, the coolest thing I discovered while looking into this is that any annotations in your XSD will be picked up and used by Visual Studio 2005 as IntelliSense comments. That means when you type an open angle bracket to start a tag, and you get the dropdown with a list of applicable tags, when you give focus to each tag VS will display tooltips for the tag based on the annotations in the XSD file. This is mentioned very briefly in this MSDN article, but I found this to be extremely useful - once I found out that I could easily enable this feature, I didn't need to Alt+Tab back and forth to the help documentation for my schema nearly as often. Very cool!!
http://blog.360.yahoo.com/smhmayboudi
Enjoy the intellisense web.config
Download this file ( DotNetConfig.xsd ):
http://www.peterritchie.com/Hamlet/Downloads/Downloads_GetFile.aspx?id=74
Then put it in this folder:
C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\
Make your web.config with this structure:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xs="DotNetConfig.xsd" xmlns:vs="http://schemas.microsoft.com/.NetConfiguration/v2.0">
[Write you web configuration here]
</configuration>
One of the local government branches had some questions on Team Foundation Server and I thought others
XML Schemas dialog in Visual Studio 2008
PingBack from http://www.keyongtech.com/546471-net-2-0-custom-web
Adding Custom Intellisense To App.config files
have u managed to find out how to use intellisense for xforms in visual studio 2008