我有一个简单的.Net Core控制台应用程序,正在尝试使用Dotfuscator Community
工具https://www.preemptive.com/dotfuscator/ce/docs/help/index.html对生成的dll进行混淆:
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;
}
}
从Add Input
选项中选择生成的dll之后,当我尝试使用Build
选项来生成它时,尽管程序在我的系统中成功构建,但我得到Build Error
(下面的截图)。本地的。
显然,从该错误看来,bin -> Debug -> netcoreapp3.1
文件夹中的System.Runtime丢失了;所以我在应用程序中安装了它,但错误仍然存在。
我的.csproj文件:
<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>