Class ObfuscateTask
This is an MSBuild task to automate obfuscation using ArmDot.
Read more about how to use ObfuscateTask
to obfuscate assemblies while building a project.
Inheritance
Implements
Namespace: ArmDot.Engine.MSBuildTasks
Assembly: ArmDot.Engine.MSBuildTasks.dll
Syntax
public class ObfuscateTask : Build.Utilities.Task, IAsyncOperationEvents
Properties
EmbeddedFiles
Inputs
stores a list of files to embed.
Notes: use %24
to encode $
For example, use %24(AssemblyDirectory)
to encode $(AssemblyDirectory)
<ItemGroup>
<FilesInfo Include="$(TargetDir)Embed\virtual_file_content2.txt">
<RuntimePath>%24(AssemblyDirectory)\embedded_file2.txt</RuntimePath>
</FilesInfo>
<FilesInfo Include="$(TargetDir)Embed\virtual_file_content3.txt">
<RuntimePath>%24(AssemblyDirectory)\embedded_file3.txt</RuntimePath>
</FilesInfo>
</ItemGroup>
<Target Name="Protect" AfterTargets="Build">
<ItemGroup>
<Assemblies Include="$(TargetDir)$(TargetFileName)" />
</ItemGroup>
<ArmDot.Engine.MSBuildTasks.ObfuscateTask
Inputs="@(Assemblies)"
EmbeddedFiles="@(FilesInfo)"
ReferencePaths="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')"
/>
</Target>
This parameter is optional.
Declaration
public ITaskItem[] EmbeddedFiles { get; set; }
Property Value
Type | Description |
---|---|
ITaskItem[] |
Inputs
Inputs
stores a list of assemblies to protect:
<Target Name="Protect" AfterTargets="Build">
<ItemGroup>
<Assemblies Include="$(TargetDir)$(TargetFileName)" />
</ItemGroup>
<ArmDot.Engine.MSBuildTasks.ObfuscateTask
Inputs="@(Assemblies)"
ReferencePaths="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')"
/>
</Target>
This parameter is required.
Declaration
public ITaskItem[] Inputs { get; set; }
Property Value
Type | Description |
---|---|
ITaskItem[] |
License
Set it to a purchased ArmDot license key.
If License
is not set, ArmDot works in the demo mode.
This parameter is optional.
Declaration
public string License { get; set; }
Property Value
Type | Description |
---|---|
System.String |
NoWarn
Suppresses the ArmDot's ability to generate warnings.
NoWarn
specifies warning number or numbers.
If you specify multiple warning numbers, separate them with a comma:
<Target Name="Protect" AfterTargets="Build">
<ItemGroup>
<Assemblies Include="$(TargetDir)$(TargetFileName)" />
</ItemGroup>
<ArmDot.Engine.MSBuildTasks.ObfuscateTask
Inputs="@(Assemblies)"
NoWarn="4"
ReferencePaths="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')"
/>
</Target>
This parameter is optional.
Declaration
public string NoWarn { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ProjectPath
ProjectPath
specifies a path to a project file that is used to store cryptography constants to generate license keys, and blacklisted license keys.
If ProjectPath
doesn't exist, a new project file is created.
Declaration
public string ProjectPath { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ReferencePaths
ReferencePaths
stores a list of directories to find referenced assemblies.
Sometimes ArmDot needs to find an assembly referenced by the assembly which is being protected.
To help ArmDot locate such an assembly, use ReferencePaths
:
<Target Name="Protect" AfterTargets="Build">
<ItemGroup>
<Assemblies Include="$(TargetDir)$(TargetFileName)" />
</ItemGroup>
<ItemGroup>
<ReferencePaths Include="C:\MyAssemblies" />
<ReferencePaths Include="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')" />
</ItemGroup>
<ArmDot.Engine.MSBuildTasks.ObfuscateTask
Inputs="@(Assemblies)"
ReferencePaths="@(ReferencePaths)"
/>
</Target>
This parameter is optional.
Declaration
public ITaskItem[] ReferencePaths { get; set; }
Property Value
Type | Description |
---|---|
ITaskItem[] |
Methods
Execute()
You never call this method.
Declaration
public override bool Execute()
Returns
Type | Description |
---|---|
System.Boolean |
OnError(String)
You never call this method.
Declaration
public void OnError(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
OnFinished(Exception)
You never call this method.
Declaration
public void OnFinished(Exception error)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | error |
OnInfo(String)
You never call this method.
Declaration
public void OnInfo(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
OnProgress(Int32)
You never call this method.
Declaration
public void OnProgress(int percent)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | percent |
OnWarning(BaseWarning)
You never call this method.
Declaration
public void OnWarning(BaseWarning warning)
Parameters
Type | Name | Description |
---|---|---|
ArmDot.Engine.Warnings.BaseWarning | warning |