NET5.0 PublishSingleFile 发布多个文件 [英] NET5.0 PublishSingleFile publish more than one file

查看:26
本文介绍了NET5.0 PublishSingleFile 发布多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在发布我的 net 5 应用程序:

dotnet publish -r win-x64 -p:PublishSingleFile=true --self-contained true

但是,结果我有:

Mode LastWriteTime Length Name---- ------------- ------ -----a---- 2/16/2021 10:20 PM 747896 clrcompression.dll-a---- 2/16/2021 10:20 PM 1322360 clrjit.dll-a---- 2/16/2021 10:20 PM 5153144 coreclr.dll-a---- 3/15/2021 11:48 AM 53841260 fff.exe-a---- 3/15/2021 11:48 AM 11300 fff.pdb-a---- 2021 年 3 月 15 日上午 11:48 537 fff.xml-a---- 2/16/2021 10:20 PM 1056640 mscordaccore.dll

仅部署 fff.exe 不起作用.也必须部署dll.为什么?可在此处找到供参考的源代码:在文件中快速查找

解决方案

改用这个命令

dotnet publish -r win-x64/p:PublishSingleFile=true/p:IncludeNativeLibrariesInSingleFile=true/p:IncludeNativeLibrariesForSelfExtract=true -c release

文档

I'm publishing my net 5 app with:

dotnet publish -r win-x64 -p:PublishSingleFile=true --self-contained true

but, as a result I have:

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        2/16/2021  10:20 PM         747896 clrcompression.dll
-a----        2/16/2021  10:20 PM        1322360 clrjit.dll
-a----        2/16/2021  10:20 PM        5153144 coreclr.dll
-a----        3/15/2021  11:48 AM       53841260 fff.exe
-a----        3/15/2021  11:48 AM          11300 fff.pdb
-a----        3/15/2021  11:48 AM            537 fff.xml
-a----        2/16/2021  10:20 PM        1056640 mscordaccore.dll

deploying just fff.exe does not work. Have to deploy dll's too. Why? Source code for reference can be found here: Fast Find in Files

解决方案

Use this command instead

dotnet publish -r win-x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesInSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -c release

Documentation

这篇关于NET5.0 PublishSingleFile 发布多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆