Reputation: 64707
I want to be able to use the AssemblyIdentities.Version in my msbuild, how do I set/change it?
Upvotes: 5
Views: 20175
Reputation: 47114
You do it with the GetAssemblyIdentity task:
<Target Name="Version">
<GetAssemblyIdentity
AssemblyFiles="$(MSBuildProjectDirectory)\src\MyApp\bin\MyApp.exe">
<Output
TaskParameter="Assemblies"
ItemName="AssemblyIdentities"/>
</GetAssemblyIdentity>
...
</Target>
AssemblyIdentities
is just a variable name. It could also be named MyAssemblyIdentities
like in the MSDN link. The Version
property reads the Version from your AssemblyInfo.cs
.
Also this SO answer provides some examples on how to use GetAssemblyIdentity
.
Upvotes: 1
Reputation: 9563
Right-click Project
->Properties
->Assembly Information
or (when have already created the properties) in project manager Properties
->AssemblyInfo.cs
.
Edit: For auto-modification from msbuild, you can use:
<FileUpdate Files="AssemblyInfo.cs"
Regex="(\d+)\.(\d+)\.(\d+)\.(\d+)"
ReplacementText="$1.$2.$3.$(Revision)" />
Upvotes: 6