我的C#Visual Studio项目在编译时生成了太多的dll文件

时间:2019-06-18 10:28:33

标签: .net msbuild

我有一个Visual Studio Win Forms项目,该项目可以正常运行。当我编译该项目以生成发行文件时,我看到我已经生成了30个dll。这些dll文件主要是System dll,所以我认为我不需要这些文件。如果删除此文件,我的应用程序将继续正常运行,但是我不知道如何对Visual Studio说,请不要生成这些文件。谁知道我该如何配置我的项目以避免生成所有这些文件?我的输出版本如下:

enter image description here

我知道我需要一些文件,但不需要系统文件。这是我的房地产项目:

enter image description here

如果我希望通过MSBuilder分析发生的情况,则会看到以下内容:

enter image description here

enter image description here

我看不到是哪个图书馆。我现在应该做什么?

1 个答案:

答案 0 :(得分:9)

欢迎来到.NET Standard DLL的地狱。

您的目标是完整的.NET Framework,但是您已经安装了依赖于.NET Standard的NuGet程序包,这将导致MSBuild从其在Program Files中的安装目录中提取外观程序集。

找到(间接)依赖于.NET Standard的程序包,然后将其升级或降级到不依赖于.NET Standard的版本。

要分析:创建您的构建和open the log file的二进制日志,搜索#include<stdio.h> #define Max_CHARS_NAME 100 struct gps_point{ double latitude; enum latitude_pole {North,South} pole; double longitude; enum longitude {East,West} dire; char location_name[Max_CHARS_NAME]; }g; int main(){ char arr[Max_CHARS_NAME]; int i = 0; printf("Enter location\n"); scanf("%s", &g.location_name); strcpy(arr,g.location_name); printf("Enter latitude\n"); scanf("%lf", &g.latitude); printf("Enter latitude pole North - 0, South - 1\n"); scanf("%d",&g.pole); //g.latitude_pole = g.pole; printf("Enter longitude dire East - 0, West - 1\n"); scanf("%d", &g.dire); printf("Enter longitude\n"); scanf("%s", &g.longitude); printf("%s is situated at (Latitude : %s %lf , Longitude: %s %lf). \n",arr,g.pole,g.latitude,g.dire,g.longitude); return 0; } 。然后,您将找到起作用的库,并且可以从那里处理依赖关系树。

某些软件包声称支持.NET Framework 4.x,但实际上在其_DependsOnNetStandard中仅包含一个netstandard11目录。