Determine assembly version during a post-build event

后端 未结 10 1554
故里飘歌
故里飘歌 2020-11-27 11:58

Let\'s say I wanted to create a static text file which ships with each release. I want the file to be updated with the version number of the release (as specified in A

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 12:41

    If you have a library project you can try to use WMIC utility (available in windows). Here is an example. Good thing - you don't need to use any external tools.

    SET pathFile=$(TargetPath.Replace("\", "\\"))
    
    FOR /F "delims== tokens=2" %%x IN ('WMIC DATAFILE WHERE "name='%pathFile%'" get  Version /format:Textvaluelist')  DO (SET dllVersion=%%x)
    echo Found $(ProjectName) version %dllVersion%
    

提交回复
热议问题