views:

365

answers:

2

We maintain a large number of .NET Project and Solution files by hand; it's ugly tedious and should be automated. The files are all XML, so writing a tool for our purposes won't be hard, but I was wondering if anyone knows of either a VS or TFS API object that would let me work with these files as objects without having to create my own class.

For our purposes we need to ensure that all projects conform to a number of standards: - base addressing - custom build types - specific properties for each build type - custom "After Build" actions

I've found the APIs for working with projects when they're loaded in Visual Studio, and am weighing the option of writing an add-in for our needs--but ideally I'd like to be able to just deserialize an object directly from the files; check that it meets requirements; make changes if needed and serialize the object back to the file.

fyi: If you're looking for the same thing let me know; I'm interested in writing this after-hours and sharing it on CodePlex. For my purposes there will be some hooks to TFS, but I'd like to create something useful to others too.

A: 

Since the are XML you could develop a tool to do what you need by calling the XML .NET Classes etc and changing what you like.

abmv
+2  A: 

Get the msbuild.xsd from your local schema cache and use xsd.exe on it.

If you want to add support for custom build tasks, use the MSBuildSchemaGen to create a custom XSD for your task assemblies first.

If the output of xsd.exe doesn't quite make you feel good, use XsdTidy to improve it.

David Schmitt