0
votes

I'm currently building a project that references SQL Server 2005 Assemblies, but I would like to have the option of building it using the 2005 or 2008 assemblies.

Currently I can open each project and change the references, but I'm looking for a better way to do this.

Is there an easy way to do this that I'm missing? If not Would it be possible to modify these with a script so I could set everything up using a script pre-build?

1

1 Answers

1
votes

I don't know if it's the best available solution, but you can implement a custom MSBuild task which reads csproj or vbproject (or any other) file and modify it depending on some MSBuild property set by the target caller.

Visual Studio projects are valid XML files, so you can use XmlDocument or XDocument.

Your custom task would look like:

<changeMSSQLVersion Version="2008" Files="@(ProjectFile)" />