For our web project, I require the assembly version of the project to version our static content.
I have declared a target in the web project file to get the assembly identity and retrieve the version number from it, like:
<PropertyGroup>
<IvanhoWebVersion>
</IvanhoWebVersion>
</PropertyGroup>
<Target Name="SetIvanhoWebVersion" AfterTargets="AfterBuild">
<Message Text="-----------------">
</Message>
<Message Text="Entering target SetIvanhoWebVersion">
</Message>
<Message Text="-----------------">
</Message>
<GetAssemblyIdentity AssemblyFiles="$(OutputPath)$(AssemblyName).dll">
<Output TaskParameter="Assemblies" ItemName="AssemblyIdentities" />
</GetAssemblyIdentity>
<CreateProperty value="%(AssemblyIdentities.Version)">
<Output TaskParameter="Value" PropertyName="IvanhoWebVersion" />
</CreateProperty>
<Message Text="Assembly version = v$(IvanhoWebVersion)">
</Message>
<Exec Command=" "$(SolutionDir)Ivanho.Lib\TranslationGenerator\TranslationGenerator.exe" "$(ProjectDir)Areas\UI\Static\locales\translationsrc\Translations-EN-NL-AR.xlsx" "$(ProjectDir)Areas\UI\Static\locales\v.$(IvanhoWebVersion)"" />
</Target>
This works like a charm when building locally, however when trying to check this in to our TFS build server it fails with the following error:
Cannot get assembly name for "bin\Ivanho.Web.dll". Could not load file or assembly 'Ivanho.Web.dll' or one of its dependencies. The system cannot find the path specified.
This error is thrown at the same line of the GetAssemblyIdentity
call.
I can't figure out why this isn't working on the build server, I'm pretty new to MSBuild, can someone point me in the right direction? Many thanks in advance!