I've been using the Microsoft SDC tasks to deploy IIS websites, and for the most part this has worked well once I grabbed the latest source from CodePlex; I ran into a few bugs that have been fixed since the last release.
Anyways, I've run into an annoyance with regards to local development builds on Windows XP. Most of our devs are still using XP for their development platform which as you may know uses an old version of IIS - IIS 5.1.
So, what does this have to do with the SDC tasks? Well, I want the MSBuild script to fail gracefully with an intelligent error message when run on Windows XP. Something like:
This version of IIS is not supported, IIS 6.0+ is required.
I couldn't find a decent built-in supported way in MSBuild to get the IIS version, let alone the operating system version. You would think this would be supported without resorting to C#, but I couldn't find a way. So what I ended up doing was using the command line "ver" command and piping that to a text file and then reading it back in. Here's what that looks like:
Powered by: newtelligence dasBlog 2.1.8102.813
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010, Shawn Neal
E-mail