读取 dll 版本的 MSBuild 任务 [英] MSBuild Task to read version of dll
本文介绍了读取 dll 版本的 MSBuild 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一个 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="libfoo.dll">
<Output TaskParameter="Assemblies" ItemName="fooAssemblyInfo"/>
</GetAssemblyIdentity>
<XmlUpdate XmlFileName="srcWebServiceModel.Extensions.config"
XPath="//extensions/behaviorExtensions/add[@name='silverlightFaults']/@type"
Value="foo.ServiceModel.Extensions.Behaviors.SilverlightFaultBehavior, foo, Version=%(fooAssemblyInfo.Version), Culture=neutral, PublicKeyToken=XXXXXXXX"/>
</Target>
这篇关于读取 dll 版本的 MSBuild 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文