MSBuild任务读取dll版本 [英] MSBuild Task to read version of dll
本文介绍了MSBuild任务读取dll版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一个MSBuild任务,该任务将告诉我特定dll的版本.是否有可用的任务?
I am looking for a MSBuild task that will tell me the version of a specific dll. Is there a task available for this?
在我的情况下,dll是.Net程序集,因此我实际上正在寻找Assembly.FullName.
In my case the dll is a .Net assembly, so I'm actually looking for Assembly.FullName.
推荐答案
感谢madgnome!我以为可以共享工作代码.
Thanks madgnome! I thought I would share the working code.
<Target Name="UpdateWebConfigVersion">
<GetAssemblyIdentity AssemblyFiles="lib\foo.dll">
<Output TaskParameter="Assemblies" ItemName="fooAssemblyInfo"/>
</GetAssemblyIdentity>
<XmlUpdate XmlFileName="src\Web\ServiceModel.Extensions.config"
XPath="//extensions/behaviorExtensions/add[@name='silverlightFaults']/@type"
Value="foo.ServiceModel.Extensions.Behaviors.SilverlightFaultBehavior, foo, Version=%(fooAssemblyInfo.Version), Culture=neutral, PublicKeyToken=XXXXXXXX"/>
</Target>
这篇关于MSBuild任务读取dll版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文