尝试构建.Net Core控制台应用程序时出现Dotfuscator错误

问题描述

我有一个简单的.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(下面的截图)。本地的。

enter image description here

显然,从该错误看来,bin -> Debug -> netcoreapp3.1文件夹中的System.Runtime丢失了;所以我在应用程序中安装了它,但错误仍然存​​在。

enter image description here

我的.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>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...