If you're using MsBuild 4.0 you can write your own inline custom Task to get this done.
and then reference the inline task elsewhere in your build script...
Using the inline Task, you have can have easy access to each part of the assembly's build number. e.g $(MajorVersionNumber)