This project is read-only.

Output variables

Sep 19, 2011 at 12:21 PM


Is it possible to get assembly version / file version as output during the build? I need to get the version info and use it in InvokeProcess activity.



Sep 20, 2011 at 3:58 AM


It's not a value that is output by the TfsVersioning custom activities however, it would be possible to capture the values by looking in an AssemblyInfo file after the "Version Assemblies" (aka, VersionAssemblyInfoFiles) task in the build template.  You would be able to grab any of the assembly metadata at that point since all of the changes will have been made.

RegEx is the easiest way to get at the value you want.  @"(?<AssemblyPropertyLine>(?<PropertyPrefix>[\[<].*{0}.*\(\x22)(?<PropertyValue>.*)(?<PropertyPostfix>\x22\)[\]>]+))" is the expression I used. If you use string.Format, you can reuse that string and {0} is filled with the name of the property that you are searching for.  "PropertyValue" will be filled with the actual AssemblyVersion/AssemblyFileVersion (or whatever property you are looking for.

This may or may not be a vague description of how to do it so let me know if you need more info.


Jul 13, 2012 at 4:31 PM

Hi there,

It would be SO MUCH MORE easy for us to have two output arguments for AssemblyVersion and AssemblyFileVersion on the VersionAssemblyInfoFiles activity. Parsing a adjusted AssemblyInfoFile to reach out of the build flow feels like a realy hack to me.

I really favor this activity over the TFSbuild extensions because of the possibility of seed files, but without knowing which version is generated by the activity, I would have to fall back.