【问题标题】:Extract RAR from MSBUILD script从 MSBUILD 脚本中提取 RAR
【发布时间】:2013-09-25 18:56:24
【问题描述】:

我知道使用 MSBuild 扩展包我可以解压缩 Zip 文件,但在我的项目中我需要解压缩 RAR 文件。

我该怎么做?

【问题讨论】:

    标签: msbuild rar


    【解决方案1】:

    使用 Exec 通过 winrar.exe/rar.exe 提取存档。 如果您已经安装了 WinRar,您可以从注册表中提取其 installdir,否则请指定您的 rar.exe 所在的位置。

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
    
    <Target Name="ExtractRar">
        <PropertyGroup>
            <RarExe>$(registry:HKEY_LOCAL_MACHINE\Software\Winrar@exe32)</RarExe>
            <archive>E:\sample.rar</archive>
            <targetDir>E:\ExtratedArchive\</targetDir>
        </PropertyGroup>
        <Exec Command="&quot;$(RarExe)&quot; x &quot;$(archive)&quot; &quot;$(targetDir)&quot;" /> 
    </Target>
    
    </Project>
    

    【讨论】:

    • @Fernando,如果 Palo 回答了您的问题,请在他的回答旁边打勾。
    猜你喜欢
    • 2011-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-22
    • 1970-01-01
    • 2016-04-12
    • 2015-05-23
    相关资源
    最近更新 更多