项目中的额外文件 (NPGSQL)
Extra files in the project (NPGSQL)
这个问题够蠢的,不过之前用NuGet不行。通过控制台安装 NuGet 包后,连接到 PostgreSQL,出现了 NetFramework 应该包含的文件。如果不复制这些文件,项目就不会启动。如何摆脱它们而不是将它们复制到程序所在的目录中。以我的理解,这些文件应该取自框架。
查看截图:
All need files in project C#
我猜你的项目中有 .Net Standard 2.0 libraries/dependencies。
.NET 4.6.1 可能会在您的输出文件夹中添加额外的运行时依赖项:
.NET 4.6.1, 4.6.2, .NET 4.7 and 4.7.1 all have partial .NET Standard
2.0 support in the natively shipped runtimes, but they still are .NET Standard 2.0 compliant by adding additional runtime dependencies into
your output folder to provide the missing functionality. NuGet along
with the runtime targeting handles automatically adding those
dependencies to your projects to provide the needed runtime support
for those extra features. A lot of those assemblies override behavior
from the base framework and .NET uses runtime redirects to route api
calls to the appropriate assemblies rather than than mscorlib.dll or
other system assemblies.
.NET 4.7.2 is the first version of the full .NET Framework that is
fully .NET Standard 2.0 compliant without any additional dependencies.
参见:https://weblog.west-wind.com/posts/2019/Feb/19/Using-NET-Standard-with-Full-Framework-NET
换句话说,面向 .NET 4.7.2 应该摆脱额外的文件。
这个问题够蠢的,不过之前用NuGet不行。通过控制台安装 NuGet 包后,连接到 PostgreSQL,出现了 NetFramework 应该包含的文件。如果不复制这些文件,项目就不会启动。如何摆脱它们而不是将它们复制到程序所在的目录中。以我的理解,这些文件应该取自框架。
查看截图: All need files in project C#
我猜你的项目中有 .Net Standard 2.0 libraries/dependencies。 .NET 4.6.1 可能会在您的输出文件夹中添加额外的运行时依赖项:
.NET 4.6.1, 4.6.2, .NET 4.7 and 4.7.1 all have partial .NET Standard 2.0 support in the natively shipped runtimes, but they still are .NET Standard 2.0 compliant by adding additional runtime dependencies into your output folder to provide the missing functionality. NuGet along with the runtime targeting handles automatically adding those dependencies to your projects to provide the needed runtime support for those extra features. A lot of those assemblies override behavior from the base framework and .NET uses runtime redirects to route api calls to the appropriate assemblies rather than than mscorlib.dll or other system assemblies.
.NET 4.7.2 is the first version of the full .NET Framework that is fully .NET Standard 2.0 compliant without any additional dependencies.
参见:https://weblog.west-wind.com/posts/2019/Feb/19/Using-NET-Standard-with-Full-Framework-NET
换句话说,面向 .NET 4.7.2 应该摆脱额外的文件。