Step 1: Add the Data Theorem NuGet feed
Add our repository as a new package source:
...
And add the API credentials, leave the username as “DOTNET”. Mac/Linux only supports ClearTextPassword
, on Windows, you can add it as an encoded password via NuGet CLI.
Step 2: Install Data Theorem obfuscator as a global tool
Code Block |
---|
dotnet tool install --global datatheorem.obfuscator |
Step 3: Configure your project
In order to add the obfuscation step you will need to add a new task in your csproj that will modify the DLL created by your project. Add the following new target at the end of your csproj:
...
That’s it, this new task will run, obfuscate your project and the packaged dll will be obfuscated.
Config explanation:
In the first part, we create an ObfuscationConfigXml
that we’ll pass to the obfuscator, there, we pass an inPath
and AssemblySearchPath
to be able to link libraries. As you can see Note:
As seen in the example config, KeepPublicApi
is set to true
, so it which means that public methods will be kept as is. It can be set to false
for better obfuscation but please note that it is likely to break the app because of .NET bindings not being able to interact with native iOS/Android APIs.