How to activate ArmDot?
After purchasing, you will get a license key which you need to specify to ArmDot in order to make it work in full mode.
Activation on Windows
On Windows, run the ArmDot application (ArmDot.exe), click License - Enter Key, enter your key, and close ArmDot. The license key has been saved to the default location, %ALLUSERSPROFILE%\ArmDot\ArmDotLicense.key. Once it has been done, both the ArmDot application and the ArmDot NuGet package work in full mode.
Also, you can use the parameter LicenseFile to specify the path of the file that contains the license key; it can be required when ArmDot is being utilized on build servers:
<Target Name="Protect" AfterTargets="AfterCompile" BeforeTargets="BeforePublish">
<ItemGroup>
<Assemblies Include="$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)" />
</ItemGroup>
<ArmDot.Engine.MSBuildTasks.ObfuscateTask
Inputs="@(Assemblies)"
ReferencePaths="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')"
SkipAlreadyObfuscatedAssemblies="true"
LicenseFile="$(ALLUSERSPROFILE)\ArmDot\ArmDotLicense.key"
/>
</Target>
Activation on Linux and macOS
On Linux and macOS you have to create a file, put the license key to it, and specify the file path in the parameter LicenseFile:
<Target Name="Protect" AfterTargets="AfterCompile" BeforeTargets="BeforePublish">
<ItemGroup>
<Assemblies Include="$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)" />
</ItemGroup>
<ArmDot.Engine.MSBuildTasks.ObfuscateTask
Inputs="@(Assemblies)"
ReferencePaths="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')"
SkipAlreadyObfuscatedAssemblies="true"
LicenseFile="/opt/armdot/ArmDotLicense"
/>
</Target>
Activation on a build server
The ArmDot NuGet package has the parameter LicenseFile which specifies the file path that contains the license key.
This parameter can be used when ArmDot is used on a build server and in such CI/CD services like Azure DevOps pipelines and GitHub workflows.
Activation in Azure DevOps pipelines
Don't place a license file to a repository; use secure files instead. Click Pipelines - Library, Secure Files, and add the file that contains your license key.
Add the task that downloads the license file to the pipeline definition file; also add an environment variable that contains the path of the downloaded file:
- task: DownloadSecureFile@1
name: armDotLicenseKey
displayName: 'Download ArmDot license key'
inputs:
secureFile: 'armdot-license-key.txt'
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
env:
ARMDOT_LICENSE_FILE_PATH: $(armDotLicenseKey.secureFilePath)
ARMDOT_LICENSE_FILE_PATH contains the path of the license file. You can use the same way for other tasks like DotNetCoreCLI@2.
Then use the environment variable in the project file:
<Target Name="Protect" AfterTargets="AfterCompile" BeforeTargets="BeforePublish">
<ItemGroup>
<Assemblies Include="$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)" />
</ItemGroup>
<ArmDot.Engine.MSBuildTasks.ObfuscateTask
Inputs="@(Assemblies)"
ReferencePaths="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')"
SkipAlreadyObfuscatedAssemblies="true"
LicenseFile="$(ARMDOT_LICENSE_FILE_PATH)"
/>
</Target>
If you wish to use ArmDotConsole
as a .NET tool, use the following syntax to install and utilize it:
- task: DotNetCoreCLI@2
displayName: 'Install ArmDotConsole as a dotnet tool'
inputs:
command: custom
custom: tool
arguments: 'install --global ArmDotConsole'
- task: CmdLine@2
displayName: 'Obfuscate using ArmDotConsole'
inputs:
script: 'ArmDotConsole --input-assembly bin\$(buildConfiguration)\net7.0\CheckPassword.dll --license-file-path armdot-license-key.txt'
workingDirectory: '$(Build.SourcesDirectory)'
Activation in GitHub workflows
Don't place the license file to your repository; use encrypted secrets instead. Navigate your repository on GitHub, then click Settings, expand Secrets and variables, and click Actions, then New repository secret. Name it ARMDOT_LICENSE_KEY and paste your license. Then click Add secret.
If you are going to use Linux, modify the workflow as shown below:
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '7.0.x' ]
steps:
- uses: actions/checkout@v3
- name: Setup .NET SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies
run: dotnet restore
- name: Save license
run: |
echo $ARMDOT_LICENSE_KEY >> ${{ runner.temp }}/ArmDotLicenseKey
shell: bash
env:
ARMDOT_LICENSE_KEY : ${{ secrets.ARMDOT_LICENSE_KEY }}
- name: Build
run: dotnet build --configuration Release --no-restore
env:
ARMDOT_LICENSE_FILE_PATH : ${{ runner.temp }}/ArmDotLicenseKey
If you plan to use Windows and utilize cmd
as a shell, it's crucial to put your license in a single line:
on: [push]
jobs:
build:
runs-on: windows-2022
strategy:
matrix:
dotnet-version: [ '7.0.x' ]
steps:
- uses: actions/checkout@v3
- name: Setup .NET SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies
run: dotnet restore
- name: Save license
run: |
echo "%ARMDOT_LICENSE_KEY%" >> ${{ runner.temp }}\ArmDotLicenseKey
shell: cmd
env:
ARMDOT_LICENSE_KEY : ${{ secrets.ARMDOT_LICENSE_KEY }}
- name: Build
run: dotnet build --configuration Release --no-restore
env:
ARMDOT_LICENSE_FILE_PATH : ${{ runner.temp }}/ArmDotLicenseKey
Then use the environment variable in the project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ArmDot.Client" Version="2023.7.0" />
<PackageReference Include="ArmDot.Engine.MSBuildTasks" Version="2023.7.0" />
</ItemGroup>
<Target Name="Protect" AfterTargets="AfterCompile" BeforeTargets="BeforePublish">
<ItemGroup>
<Assemblies Include="$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)" />
</ItemGroup>
<ArmDot.Engine.MSBuildTasks.ObfuscateTask
Inputs="@(Assemblies)"
ReferencePaths="@(_ResolveAssemblyReferenceResolvedFiles->'%(RootDir)%(Directory)')"
SkipAlreadyObfuscatedAssemblies="true"
LicenseFile="$(ARMDOT_LICENSE_FILE_PATH)"
/>
</Target>
</Project>
If you wish to use ArmDotConsole
as a .NET tool, use the following syntax to install and utilize it:
- name: Install ArmDotConsole
run: dotnet tool install --global ArmDotConsole
- name: Obfuscate
run: ArmDotConsole --input-assembly bin/Release/net7.0/PasswordValidator.dll --license-file-path "${{ env.ARMDOT_LICENSE_KEY }}"
Activation when using the ArmDot command line tool
If you are using the command line tool, you can specify the path of the file that contains your license key by using the parameter --license-file-path.