Use this article to troubleshoot errors that occur when running Dotfuscator on a build agent.
Restore NuGet Packages from a Solution in Azure Pipelines
After integrating Dotfuscator into an Azure Pipelines build, a NuGet Restore step may fail even when the NuGet pipeline task appears to have completed.
Expand the console output for the NuGet Restore step and look for:
- error MSB4019: The imported project "PreEmptive.Dotfuscator.Common.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
This error occurs because MSBuild cannot locate the Dotfuscator Targets file. MSBuild exits before it can generate the project’s dependency list.
Provide MSBuild with the location of the Dotfuscator Targets file on the build server.
Add the following environment variable to the Azure Pipelines job:
- Name: NUGET_RESTORE_MSBUILD_ARGS
Value:
-p:DotfuscatorMSBuildDir="<install dir>/PreEmptive.Protection.Dotfuscator.Pro/tools/msbuilddir"
Replace <install dir> with the path to the Dotfuscator Targets file on the build server.
For additional information, refer to:
- Microsoft documentation about Azure Pipelines variables.
- The Dotfuscator Build Agents documentation.