Is there any way to get an assembly’s version number like we previously used to do with Msbuild with Team Build 2010 Workflow? Here is a simple example of how we used to get an assemby’s version with %(Info.Version).
<Target Name="CheckFileVersion" DependsOnTargets="AfterDrop">
<ItemGroup>
<MyAssemblies Include='$(DropLocation)\$(BuildNumber)\Release\MyApp.exe' />
</ItemGroup>
<GetAssemblyIdentity AssemblyFiles="@(MyAssemblies)">
<Output TaskParameter="Assemblies" ItemName="Info"/>
</GetAssemblyIdentity>
</Target>
I’ve found some methods to create custom Activities with many lines of code, but I think there must be a simpler way to do it.
GoRoS had the right idea, but it only works correctly the first time.
In order to avoid this problem you have to run this code, or similar code in a different AppDomain from the Build Agent, Powershell and an InvokeProcessActivity can solve our problem.
GetAssemblyVersionNumber.ps1:
And the following gets added to your build process template