MSBuild未知函数'文件::get-checksum'

本文关键字:get-checksum 未知 文件 函数 MSBuild | 更新日期: 2023-09-27 18:11:09

我正在尝试使用MSBuild获得文件的MD5,并给出错误:

C:'TeamCity'buildAgent'work'3614a553d9bd12e6'IntegradorWS.build(488,6):
Unknown function 'file::get-checksum'.
Expression: ${servicos.senha}${file::get-checksum(publicar.zip, 'MD5')}
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

添加MSBuild。ExtensionPack from References and .csproj in import:

<Import Project="C:'Program Files'MSBuild'ExtensionPack'4.0'MSBuild.ExtensionPack.tasks" />

此代码错误:

<property name="publicar.checksum" value="${servicos.senha}${file::get-checksum(publicar.zip, 'MD5')}" />

MSBuild未知函数'文件::get-checksum'

属性行的语法看起来不像MSBuild语法。我这样做了:

 <MSBuild.ExtensionPack.FileSystem.File TaskAction="GetChecksum" Path="test.txt">
   <Output TaskParameter="Checksum" PropertyName="chksm"/>
 </MSBuild.ExtensionPack.FileSystem.File>
 <Message Text="MD5 checksum is: $(chksm)" />

输出显示文件的MD5校验和:

  Getting Checksum for file: test.txt
  MD5 checksum is: 3BAB25A3E651A9E4A00473D2257B99F9