MSBuild Reference
To learn more about using Dotfuscator with MSBuild see the MSBuild Interface page.
Install Location
The MSBuild components are installed in the $(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4
directory.
$(MSBuildExtensionsPath)
is pre-defined by MSBuild, and its value varies depending on which MSBuild you are using. Dotfuscator installs into the system-wide MSBuild extensions path as well as the MSBuild extensions path for each Visual Studio you enabled integration for when installing.
The $(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4
path will reference the latest components installed from the 4.x.x
series. There are further subdirectories if you want to refer to the latest in a minor series (like 4.98.x
) or to a specific version (like 4.98.1
). This is helpful when using Side-by-Side Installs. The directory structure looks like this:
$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\<major>
$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\<major>\<major>.<minor>
$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\<major>\<major>.<minor>\<major>.<minor>.<patch>
For instance, let's say you install the (fictitious) versions 4.98.0
, 4.98.1
, and 4.99.0
side-by-side. Below is an annotated listing of the directories and what they contain:
<!-- Contains 4.98.0 -->
$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\4.98\4.98.0
<!-- Contains 4.98.1 -->
$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\4.98
$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\4.98\4.98.1
<!-- Contains 4.99.0 -->
$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4
$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\4.99
$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\4.99\4.99.0
Targets Reference
Dotfuscator's MSBuild targets, PreEmptive.Dotfuscator.Common.targets, make it easy to integrate Dotfuscator into a Visual Studio or MSBuild project. The targets are designed to run Dotfuscator immediately following the assembly build process, before packaging.
Available Properties
The following properties are understood by the Dotfuscator targets.
-
- Determines whether the Dotfuscator integration will run.
- If "true", Dotfuscator will protect the project.
- If "false", Dotfuscator will be skipped for this build.
- Defaults to "false".
- Determines whether the Dotfuscator integration will run.
-
- Path to the Dotfuscator config file, relative to the same directory as the MSBuild project file.
- This file does not need to exist if "DotfuscatorGenerateConfigFileIfMissing" is set to "true".
- Defaults to "DotfuscatorConfig.xml".
DotfuscatorGenerateConfigFileIfMissing
- Determines what happens during a build if the file specified by "DotfuscatorConfigPath" does not exist.
- If "true", Dotfuscator generates a new config file at that path using relevant MSBuild properties.
- If "false", Dotfuscator errors the build.
- Defaults to "true".
- Determines what happens during a build if the file specified by "DotfuscatorConfigPath" does not exist.
DotfuscatorAndroidSigningCertFingerprint
- Specifies the SHA-1 fingerprint of the certificate used to sign the Xamarin Android App.
- Only required when injecting Tamper Check into a Xamarin Android app.
- This property is not set by default.
-
- Specifies a Dotfuscator license key to activate and use for this run of Dotfuscator. Typically this will be done with a Floating license.
- The value of this property will be used even if another license key is also specified through an environment variable or in the license file.
- This property is not set by default.
Note: Do not put quotes around any property value, nor end any with a slash or backslash.
MSBuild Task Reference
Dotfuscator provides an MSBuild interface using tasks defined in PreEmptive.Dotfuscator.Tasks.dll.
There is also a targets template that you can import into your MSBuild scripts, PreEmptive.Dotfuscator.targets. This file is installed into the same directories.
Dotfuscate Task
You can run Dotfuscator from MSBuild using the Dotfuscate task. Below are the properties provided by the Dotfuscate task.
Property | Type | Description |
---|---|---|
ConfigPath |
string |
Required. Write-only. Sets the path to the Dotfuscator config. |
DebugSymbols |
string[] |
Read-only. Exposes PDB files associated with output assemblies. The PreEmptive.Dotfuscator.targets file exposes this property as an output Item named DotfuscatedDebugSymbols |
InputAssemblies |
ITaskItem[] |
Write-only. Sets the input assemblies. Inputs specified in InputAssemblies are merged with the inputs listed in the Dotfuscator config. |
InputManagement |
string |
Write-only. Sets how the Dotfuscate task uses inputs. If automatic Dotfuscator gets inputs only from the InputAssemblies property and updates the inputs in the config to match. If manual or unspecified, Dotfuscator will merge the inputs specified in InputAssemblies and specified in the config. |
License |
string |
Specifies a Dotfuscator license key to activate and use for this run of Dotfuscator. Typically the key should be for a Floating license. The value of this property will be used even if another license key is specified by an environment variable or in the license file. |
MappingFile |
string |
Read-only. Exposes the renaming map file. The PreEmptive.Dotfuscator.targets file exposes this property as an output Item named DotfuscatorMappingFile. |
OutputAssemblies |
string[] |
Read-only. Exposes output assemblies. The PreEmptive.Dotfuscator.targets file exposes this property as an output Item named DotfuscatedAssemblies. |
OutputDirectory |
string |
Write-only. Sets the directory where Dotfuscator will write the output assemblies. This overrides the output directory specified in the Dotfuscator config. |
Properties |
string |
Write-only. Sets user-defined external properties. The string must contain a valid XML element with child elements that represent key/value pairs. For example: <Properties> <Property1>Value1</Property1> <Property2>2</Property2> </Properties> |
ReportFiles |
string[] |
Read-only. Exposes report files such as renaming HTML report and removal reports. |
SatelliteAssemblies |
string[] |
Read-only. Exposes satellite assemblies associated with output assemblies. The PreEmptive.Dotfuscator.targets file exposes this property as an output Item named DotfuscatedSatelliteAssemblies. |
PreMark Task
You can extract watermarks from previously watermarked assemblies using the PreMark task. This provides similar functionality to the command line program Premark.exe included in your Dotfuscator installation directory.
Property | Type | Description |
---|---|---|
InputAssemblyPath |
string |
Required. Read/Write. Gets or sets the path to the Assembly whose watermark you want to extract. |
UsePassphrase |
bool |
Read/Write. |
Passphrase |
string |
Read/Write. Currently, the input assemblies must also be listed in the Dotfuscator config. This is only for interoperation with Visual Studio-generated project files. This may change in the future. |
Watermark |
string |
Read-only. Exposes the extracted watermark string. |