在生成后事件中读取程序集版本号吗? [英] Read assembly version number in post-build event?

查看:71
本文介绍了在生成后事件中读取程序集版本号吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将程序集信息更改为1.0.0.1时,我以为我可以使用$(Version)读取版本,但似乎没有改变吗?

When I change the assembly information to lets say 1.0.0.1 i thought that i could read the version with $(Version) but it seems that it does not change?

推荐答案

您可以使用GetAssemblyIdentity任务来检索版本:

You could use the GetAssemblyIdentity task to retrieve the version :

<Target Name="AfterBuild">
  <GetAssemblyIdentity AssemblyFiles="$(OutputPath)\$(AssemblyName).$(OutputType)">
    <Output TaskParameter="Assemblies" ItemName="AssemblyIdentities"/>
  </GetAssemblyIdentity>

  <PropertyGroup>
    <CssOutputFile Condition="'$(CssOutputFile)'==''">
      ..\Styles\master-%(AssemblyIdentities.Version).css
    </CssOutputFile>
  </PropertyGroup>
  <Message Text="CssOutputFile : $(CssOutputFile)"/>
</Target>

这篇关于在生成后事件中读取程序集版本号吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆