Wix工具集输出命名

时间:2016-10-31 04:38:20

标签: wix

我的Wix项目文件中有以下内容。它生成一个名为prog.1.12.123.1234.msi的安装程序。这接近我想要的但不完全。我需要的是将文件命名为prog.1.12.123.msi,并排除修订号。有没有一种简单的方法可以执行此操作,还是必须编写自定义文件重命名器,然后使用msbuild EXEC任务调用它?

  <Target Name="AfterBuild">
    <GetAssemblyIdentity AssemblyFiles="C:\prog.exe">
      <Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
    </GetAssemblyIdentity>
    <Copy SourceFiles=".\bin\$(Configuration)\$(OutputName).msi" DestinationFiles=".\bin\$(Configuration)\$(OutputName)_%(AssemblyVersion.Version).msi" />
    <Delete Files=".\bin\$(Configuration)\$(OutputName).msi" />
  </Target>
</Project>

1 个答案:

答案 0 :(得分:0)

写过DOS的人一定是在吸烟。最简单的解决方案是相当复杂的DOS重命名:

if "!%currentuser%program1!" == "None" (
  REM EASTER EGG this is here because i am not confident with using the not switch
) 
ELSE 
(
  echo 1)!%currentuser%program1!
)