How to automatically tag Mercurial in a Visual Studio publication?

I use TortoiseHg + VisualHg in Visual Studio 2008. Has anyone found a way to automatically create a tag (with published version number) in Mercurial whenever I publish VS?

+4
source share
2 answers

You can run a custom script to perform the hg tag operation as the "AfterPublish" action. Take a look at the MSBuild documentation:

You will need to modify your project to add a custom goal as follows:

 <Project> ... <Target Name="AfterBuild"> <Exec Command="hg tag %(TAGNAME)"/> </Target> </Project> 
+3
source

Thanks to gavinb answer and Sumo comment. So I did this for my WinForms application:

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Target Name="AfterPublish"> <GetAssemblyIdentity AssemblyFiles="$(OutputPath)\$(AssemblyName).exe"> <Output TaskParameter="Assemblies" ItemName="AssemblyIdentities" /> </GetAssemblyIdentity> <Exec Command="hg tag %(AssemblyIdentities.Version)" /> </Target> 
+1
source

Source: https://habr.com/ru/post/1305529/


All Articles