Created
April 14, 2024 21:01
-
-
Save Infarh/88ec380fe976dd7a4a8b84712333da9d to your computer and use it in GitHub Desktop.
ProjectHack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<UsingTask TaskName="ZipDir" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll"> | |
<ParameterGroup> | |
<ZipFileName ParameterType="System.String" Required="true" /> | |
<DirectoryName ParameterType="System.String" Required="true" /> | |
</ParameterGroup> | |
<Task> | |
<Reference Include="System.IO.Compression.FileSystem" /> | |
<Using Namespace="System.IO.Compression" /> | |
<Code Type="Fragment" Language="cs"> | |
<![CDATA[ | |
try | |
{ | |
Log.LogMessage(string.Format("Zipping Directory {0} to {1}", DirectoryName, ZipFileName)); | |
ZipFile.CreateFromDirectory( DirectoryName, ZipFileName ); | |
return true; | |
} | |
catch(Exception ex) | |
{ | |
Log.LogErrorFromException(ex); | |
return false; | |
} | |
]]> | |
</Code> | |
</Task> | |
</UsingTask> | |
<Target Name="ZipOutput" AfterTargets="Build"> | |
<ZipDir | |
ZipFileName="$(OutDir)../MyZipFileName.zip" | |
DirectoryName="$(OutDir)" | |
/> | |
<Message Text="Zipped: $(OutDir)" Importance="high"/> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment