A few months ago I was working on a project that required the creation of full schemas for the configuration files used by Community Server. The end goal of the project was to make it gut-splittingly easy to edit any of the settings in these configuration files. Paying special attention to the difficulty of this in hosted scenarios.
Now, I guess you could say that the project is ongoing, but in reality I haven't touched it for at least two months. If I sensed that there was a big demand for such a capability, I may be enticed to revive it. However, there have been much more pressing issues to deal with lately.
Visual Studio 2005 Intellisense
As you probably know, one of the inherent bonuses of creating a full XML schema for each configuration file is the potential for leveraging the Intellisense capabilities of Visual Studio. It's really a fantastic feature. Essentially, a simple XSD file can be used to not only provide validation of your custom XML file, but also tooltips with documentation and dropdowns with available elements, attributes, or values. Channel 9 has a pretty good screencast on the topic and Mikhail Arkhipov has a related blog post if you would like more information on this feature.
Community Server Schemas Revived
Although the XML schemas for version 2.1 of Community Server existed in late 2006, they were never released into the wild. At the time, there didn't seem to be any reason to do so. Now, with first beta the release of Community Server 2007, there is a reason to share them. [Heading to the closet with duster in hand]
I've updated the files to reflect the changes to the configuration files for Community Server 2007. You can download them from CommunityServer.org.
Installation
Installation is pretty straightforward. Simply download the file, unzip the contents and paste them into your Visual Studio 2005 Intellisense schema directory (typically C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas). Do make sure to restart Visual Studio if you already had it open in order for the changes to take effect.
A more detailed graphical version:
- Backup DotNetConfig.xsd.
- Unzip files.
- Copy files.
- Restart Visual Studio
- Use Communtiy Server Intellisense. (envision a mouse cursor over the 'extensions' attribute in this example.)
How Does this Actually Work
Very carefully. The schema file that is used to provide Intellisense for all .config files is modified to also support Community Server .config files.
If you open catalog.xml, you will see the following line at the very bottom.
This assigns DotNetConfig.xsd as the file to use for validation and Intellisense of all .config files in Visual Studio.
So, to add support for Community Server configuration files (CommunityServer.config and SiteUrls.config), simply include their schema definitions in DotNetSchema.xsd.
The CS-2007-b1 directory contains all of the Community Server schema files and the rest is magic.
Unintended Consequences
Originally, the schema files were created with proper namespaces for the Community Server configuration elements. For example, each of the schema files for beta 1 of Community Server 2007 should probably have a target namespace of something like http://schemas.telligent.com/CommunityServer/v2007_b1. This enables each version to have a unique namespace and keeps the Community Server specific elements separate from any other elements used for Visual Studio Intellisense.
However, due to the way the configuration files are currently loaded and processed they cannot have a custom namespace. That is why you may notice that the elements are in the global namespace. Yes, this is a bit of a hack and it enables Visual Studio Intellisense on the files yet still allows them to be properly loaded by Community Server.
As long as there are no conflicts between the Community Server schemas and any of the other schemas used for .config files, one may inquire, why does it really matter? Well, that is an interesting point. The answer is found by simply seeing what happens to the Intellisense in a standard web.config file.
Huh? You mean I can now configure Community Server in the web.config file? No. One thing that may be helpful with this is to notice that most of the Community Server elements are capitalized while the standard web.config elements are not.
You Choose
Using the Community Server schema files provides the wonderful benefit of Visual Studio Intellisense. But remember, it may also make the Intellisense in web.config files more cumbersome (at least until the Community Server configuration files are placed in an independent namespace.)
Questions or Contributions
The schema files have been polished in no shape or form. As I said earlier, they are simply dusted off from a previous effort. If you find problems, think a rule needs added or adjusted, or have comment to add feel free to ping me.
*Note: The schema files are not official or part of the core Community Server release package. Use at your own risk. :)