I'm using the publish to file-system option in Visual Studio, and I'd like the publish process to automatically append the assembly version-number to the output directory when I publish a project.
Google just isn't getting me the answer.
Is this possible? How-to?
I would get the assembly version as described in the following posts:
MSBuild Task to read version of dll
Access Version from AssemblyInfo in MSBuild
As follows[Altered version of the code as described in the given links]:
<PropertyGroup>
<AssemblyList>myfolder\myLibrary.dll</AssemblyList>
</PropertyGroup>
<Target Name="AssemblyInformations">
<GetAssemblyIdentity
AssemblyFiles="$(AssemblyList)">
<Output
TaskParameter="Assemblies"
ItemName="AssemblyInfos"/>
</GetAssemblyIdentity>
<Message Text="Files: %(AssemblyInfos.Version)"/>
And then I would use something like the following to create a directory in the place you want to publish:
<CreateProperty Value="$(Public_Shared_Folder)$(ProjectName)\">
<Output TaskParameter="Value" PropertyName="PublicFolderToDropZip" />
</CreateProperty>
<MakeDir Directories="$(PublicFolderToDropZip)" Condition="$(Configuration)=='Release' And !Exists('$(PublicFolderToDropZip)')" />
The entire operation can be completely automated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With