I have a simple .Net Core console app and am trying to obfuscate the generated dll using Dotfuscator Community tool https://www.preemptive.com/dotfuscator/ce/docs/help/index.html:
class Program
{
public static void Main()
{
Console.Write("\n\nFunction to calculate the sum of two numbers :\n");
Console.Write("--------------------------------------------------\n");
Console.Write("Enter a number: ");
int n1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter another number: ");
int n2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nThe sum of two numbers is : {0} \n", Sum(n1, n2));
Console.ReadKey();
}
public static int Sum(int num1, int num2)
{
int total;
total = num1 + num2;
return total;
}
}
After choosing the generated dll from the Add Input option, when I try to build it using the Build option, I get Build Error(screenshot below) although the program builds successfully in my local.
Apparently, from the error, it seemed that System.Runtime inside the bin -> Debug -> netcoreapp3.1 folder is missing; so I installed it in my application, but the error still persists.
My .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Obfuscar" Version="2.2.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup>
</Project>

