Skip to content

Instantly share code, notes, and snippets.

@Platonenkov
Created June 1, 2024 17:23
Show Gist options
  • Save Platonenkov/ff3c670e8bbe912d9da72da70a0fdff3 to your computer and use it in GitHub Desktop.
Save Platonenkov/ff3c670e8bbe912d9da72da70a0fdff3 to your computer and use it in GitHub Desktop.
Автоматическая упаковка релиза в архив RAR
  <Target Name="RarOutput" AfterTargets="ZipOutput">
    <PropertyGroup>
      <ArchiveFileName>FileName</ArchiveFileName>
      <ArchiveFilePath>$([System.IO.Path]::GetFullPath($(OutDir)../$(ArchiveFileName)))</ArchiveFilePath>
      <ProgramFilesPath>$([System.Environment]::GetEnvironmentVariable("ProgramFiles"))</ProgramFilesPath>
      <RarPath>$([System.IO.Path]::Combine($(ProgramFilesPath), "WinRAR", "Rar.exe"))</RarPath>
    </PropertyGroup>
    <Message Text="RAR path: $(RarPath)" Importance="high" Condition="Exists($(RarPath))"/>
    <Exec Command="&quot;$(RarPath)&quot; a -ep1 -v25600k -tsmcap -m5 -r -k -s -tl -dh -ag[yyyy-MM-ddThh-mm-ss] -hp&quot;File&quot; -x&quot;*.pdb&quot; &quot;$(ArchiveFilePath)(pass=File)&quot; &quot;$(OutDir)&quot;" IgnoreExitCode="true" Condition="Exists($(RarPath))"/>
    <Exec Command="&quot;$(RarPath)&quot; a -ep1 -tsmcap -m5 -r -k -s -tl -dh -ag[yyyy-MM-ddThh-mm-ss] -x&quot;*.pdb&quot; &quot;$(ArchiveFilePath)&quot; &quot;$(OutDir)&quot;" IgnoreExitCode="true" Condition="Exists($(RarPath))"/>
    <Message Text="Rared: $(ArchiveFilePath)" Importance="high" Condition="Exists($(RarPath))"/>
  </Target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment