Poor man's AssemblyInfo check in MSBuild
I've seen many samples and had to personally manipulate the version information in AssemblyInfo during the build process on several occasions. However, I received a red-alert from a co-worker who want to check to make sure the default assembly info (220.127.116.11) was not being used. For his client, this situation was supposed to break the build.
I started with what I believe were the correct answers. That is - if it is a policy, catch it during the check in process using a custom check-in policy. Or at least create a custom build task to gracefully perform the checks during the build.
Unfortunately, time and customer needs didn't allow either. So I offered the cheap way out. This isn't as powerful or robust as either of the aforementioned solutions, but it should work based on our time constraints. I don't recommend that you make use of this as is, but perhaps you'll glance at it and find a different use for these built-in MSBuild tasks in some other build exercise that you run across...
<?xml version="1.0" encoding="utf-8"?>
<!-- Standard item creation - in my case to find all assembly info files -->
<!-- Next, read all lines from all files into items -->
<!-- Finally, force an error if any of the lines exactly matches a predefined value --> <Error
Text="Default assembly version (CS) detected in the build"
Condition="'%(ItemsFromFile.Identity)'=='[assembly: AssemblyVersion("18.104.22.168")]' " />
Text="Default assembly version (VB) detected in the build"
Condition="'%(ItemsFromFile.Identity)'=='<Assembly: AssemblyVersion("22.214.171.124")>' " />