Created
April 13, 2014 20:57
-
-
Save dmunch/10602023 to your computer and use it in GitHub Desktop.
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
<?xml version="1.0" encoding="utf-8" ?> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Target Name="AfterResolveReferences"> | |
<CallTarget Targets="Obfuscate"/> | |
</Target> | |
<Target Name="AfterClean"> | |
<CallTarget Targets="CleanObfuscate"/> | |
</Target> | |
<Target Name="GetTargets"> | |
<MSBuild Projects="@(ProjectReference)" Targets="GetTargetPath"> | |
<Output TaskParameter="TargetOutputs" ItemName="Targets" /> | |
</MSBuild> | |
</Target> | |
<Target Name="Obfuscate" | |
DependsOnTargets="GetTargets" | |
Inputs="%(Targets.fullpath)" | |
Outputs="$(IntermediateOutputPath)\Obfuscation\%(Targets.filename)%(Targets.extension)"> | |
<PropertyGroup> | |
<DefineConstants>ObfsDir=$(IntermediateOutputPath)\Obfuscation\</DefineConstants> | |
</PropertyGroup> | |
<CreateItem Include="@(Targets->'%(relativedir)\*.dll')"> | |
<Output TaskParameter="Include" ItemName="Dependencies"/> | |
</CreateItem> | |
<MakeDir Directories="$(IntermediateOutputPath)\Obfuscation\"/> | |
<!-- Copy all references to intermediate output path --> | |
<Copy SourceFiles='%(Targets.fullpath)' DestinationFolder='$(IntermediateOutputPath)\Obfuscation\'/> | |
<!-- Copy all dependencies --> | |
<Copy SourceFiles='@(Dependencies)' DestinationFolder='$(IntermediateOutputPath)\Obfuscation\'/> | |
<!-- Start obfuscator --> | |
<Exec Command='Obfuscator.exe "$(IntermediateOutputPath)\Obfuscation\%(Targets.filename)%(Targets.extension)"'/> | |
</Target> | |
<Target Name='CleanObfuscate'> | |
<CreateItem Include='$(IntermediateOutputPath)\Obfuscation\*.*'> | |
<Output TaskParameter="Include" ItemName="FilesToRemove"/> | |
</CreateItem> | |
<Delete Files='@(FilesToRemove)'/> | |
<RemoveDir Directories='$(IntermediateOutputPath)\Obfuscation\'></RemoveDir> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment