为什么 .Net Core 2.2 现在发布了大量其他 dll
Why is .Net Core 2.2 now publishing a ton of other dlls
我刚刚将我的 .net core 2.0 项目升级到 2.2。据我所知,我没有更改任何其他设置,但现在当我发布到我的文件系统时,它会发布大量以前没有的文件夹和 dll。
我需要发布它们吗?如果不是,我可以抑制他们的输出吗?
这是我的发布配置文件设置:
这是升级前输出目录的样子:
现在,这里只是输出目录的一个片段:
Introduction: This issue seems to result from .net core 2.0.
来自您在上面分享的图片。我知道您选择了框架相关模式。
在此模式下,生成的文件应该与图 1 中的文件类似。如果你选择自包含模式,生成的文件应该像图2中的那样。
但在.net core2.0中,似乎有些不同。当我们在 .net core2.0 中发布项目时,或者像您一样刚从 2.0 升级。我们必须显式设置self-contained属性为false,这样Framework-Dependent模式才能正常工作。
Do I need to publish them?
不,您不需要发布自包含模式生成的文件,因为您选择依赖于框架的模式。
If not, can I suppress their output?
这是一种解决方法:
好像是用VSIDE发布的,发布的时候一定要选择'create profile'。所以我们将有一个 PublishProfile,我们可以在 Solution Window 的 Properties 下面找到它。打开 FolderProfile.pubxml 并在 PropertyGroup
中添加 <PublishWithAspNetCoreTargetManifest>true</PublishWithAspNetCoreTargetManifest>
。此外,我们可以将 <DeleteExistingFiles>false</DeleteExistingFiles>
设置为 true。
之后,重新发布项目即可解决问题。
PublishProfiles 的最终格式如下所示:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
...
<publishUrl>bin\Release\netcoreapp2.2\publish\</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PublishWithAspNetCoreTargetManifest>true</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
</Project>
此外:您可以从 this issue 中找到更多信息。感谢 natemcmaster。他的建议对我有用。
我刚刚将我的 .net core 2.0 项目升级到 2.2。据我所知,我没有更改任何其他设置,但现在当我发布到我的文件系统时,它会发布大量以前没有的文件夹和 dll。
我需要发布它们吗?如果不是,我可以抑制他们的输出吗?
这是我的发布配置文件设置:
这是升级前输出目录的样子:
现在,这里只是输出目录的一个片段:
Introduction: This issue seems to result from .net core 2.0.
来自您在上面分享的图片。我知道您选择了框架相关模式。
在此模式下,生成的文件应该与图 1 中的文件类似。如果你选择自包含模式,生成的文件应该像图2中的那样。
但在.net core2.0中,似乎有些不同。当我们在 .net core2.0 中发布项目时,或者像您一样刚从 2.0 升级。我们必须显式设置self-contained属性为false,这样Framework-Dependent模式才能正常工作。
Do I need to publish them?
不,您不需要发布自包含模式生成的文件,因为您选择依赖于框架的模式。
If not, can I suppress their output?
这是一种解决方法:
好像是用VSIDE发布的,发布的时候一定要选择'create profile'。所以我们将有一个 PublishProfile,我们可以在 Solution Window 的 Properties 下面找到它。打开 FolderProfile.pubxml 并在 PropertyGroup
中添加 <PublishWithAspNetCoreTargetManifest>true</PublishWithAspNetCoreTargetManifest>
。此外,我们可以将 <DeleteExistingFiles>false</DeleteExistingFiles>
设置为 true。
之后,重新发布项目即可解决问题。
PublishProfiles 的最终格式如下所示:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
...
<publishUrl>bin\Release\netcoreapp2.2\publish\</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PublishWithAspNetCoreTargetManifest>true</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
</Project>
此外:您可以从 this issue 中找到更多信息。感谢 natemcmaster。他的建议对我有用。