如何解决尝试构建.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
(下面的截图)。本地的。
显然,从该错误看来,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>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。