发布 .NET 6.0 控制台应用程序需要包含哪些关联的 DLL?

问题描述 投票:0回答:1

我在 Microsoft Visual Studio 中编写了一个控制台应用程序,并使用“批量构建”命令进行编译。我已按照教程的指示将此可执行文件放入其自己的文件夹中,以便它可以作为 Windows 10“任务计划程序”中的任务运行。有用。我的意思是,它似乎是从我的计算机运行的。

我的 IT 人员希望它在公司的服务器上运行。所以他向我展示了如何从“任务计划程序”下载设置。 该文件是一个

.XML
文件。

我与他共享了包含

.EXE
.XML
文件的文件夹,他最近回来告诉我,当他尝试从命令行运行该程序时(顺便说一句,这是一个控制台应用程序) ),他收到一条错误消息,指出缺少 .DLL。

发布 .NET 6.0 控制台应用程序需要包含哪些关联的 DLL?我进入 Microsoft Visual Studio 构建可执行文件的发行版的目录,看到了很多 .DLL。哪些应该通过移动到文件夹来使用。我还有其他方法可以做到这一点吗?请指教。

这是

Release
文件夹中的文件列表(多么大的列表啊!当然,它们不可能都是必需的!):

 Volume in drive C is OS
 Volume Serial Number is C292-BE2E

 Directory of C:\source\repos\SharePointListCreation\bin\Release\net6.0

09/26/2024  09:29 AM    <DIR>          .
09/26/2024  09:29 AM    <DIR>          ..
01/15/2023  05:45 PM           406,528 AngleSharp.Css.dll
05/31/2022  01:44 PM           882,176 AngleSharp.dll
07/26/2021  06:36 PM           378,744 Microsoft.ApplicationInsights.dll
11/12/2018  12:30 PM            22,904 Microsoft.AspNetCore.Hosting.Abstractions.dll
11/12/2018  12:30 PM            15,224 Microsoft.AspNetCore.Hosting.Server.Abstractions.dll
11/12/2018  12:29 PM            76,152 Microsoft.AspNetCore.Http.Abstractions.dll
11/12/2018  12:29 PM            38,776 Microsoft.AspNetCore.Http.Extensions.dll
11/12/2018  12:28 PM            32,120 Microsoft.AspNetCore.Http.Features.dll
11/12/2018  12:37 PM            70,520 Microsoft.AspNetCore.StaticFiles.dll
10/22/2021  06:47 PM            27,264 Microsoft.Extensions.Caching.Abstractions.dll
01/14/2022  02:54 PM            38,504 Microsoft.Extensions.Caching.Memory.dll
10/22/2021  06:47 PM            25,216 Microsoft.Extensions.Configuration.Abstractions.dll
10/22/2021  06:48 PM            43,632 Microsoft.Extensions.DependencyInjection.Abstractions.dll
09/26/2022  12:42 PM            82,560 Microsoft.Extensions.DependencyInjection.dll
11/10/2018  07:26 PM            17,976 Microsoft.Extensions.FileProviders.Abstractions.dll
11/12/2018  12:30 PM            22,904 Microsoft.Extensions.Hosting.Abstractions.dll
10/22/2021  06:50 PM            68,736 Microsoft.Extensions.Http.dll
10/22/2021  06:51 PM            62,064 Microsoft.Extensions.Logging.Abstractions.dll
10/22/2021  06:50 PM            44,656 Microsoft.Extensions.Logging.dll
10/22/2021  06:50 PM            59,008 Microsoft.Extensions.Options.dll
10/22/2021  06:51 PM            40,048 Microsoft.Extensions.Primitives.dll
11/12/2018  12:28 PM            19,832 Microsoft.Extensions.WebEncoders.dll
03/25/2021  06:18 PM           142,224 Microsoft.Graph.Core.dll
05/20/2021  05:05 PM         8,584,592 Microsoft.Graph.dll
06/06/2024  05:09 PM         1,005,600 Microsoft.Identity.Client.dll
06/06/2024  05:14 PM            66,592 Microsoft.Identity.Client.Extensions.Msal.dll
08/21/2024  11:16 PM            20,000 Microsoft.IdentityModel.Abstractions.dll
08/21/2024  11:16 PM           155,160 Microsoft.IdentityModel.JsonWebTokens.dll
08/21/2024  11:16 PM            36,896 Microsoft.IdentityModel.Logging.dll
08/21/2024  11:16 PM           337,432 Microsoft.IdentityModel.Tokens.dll
11/12/2018  12:28 PM            74,616 Microsoft.Net.Http.Headers.dll
08/20/2024  02:34 PM           101,056 Microsoft.Office.Client.Policy.dll
08/20/2024  02:34 PM            41,720 Microsoft.Office.Client.TranslationServices.dll
08/20/2024  02:34 PM           108,120 Microsoft.Office.SharePoint.Tools.dll
08/20/2024  02:34 PM           528,520 Microsoft.Online.SharePoint.Client.Tenant.dll
08/20/2024  02:34 PM           416,536 Microsoft.ProjectServer.Client.dll
08/20/2024  02:34 PM         1,493,144 Microsoft.SharePoint.Client.dll
08/20/2024  02:34 PM            50,920 Microsoft.SharePoint.Client.DocumentManagement.dll
08/20/2024  02:34 PM           168,680 Microsoft.SharePoint.Client.Publishing.dll
08/20/2024  02:34 PM           200,888 Microsoft.SharePoint.Client.Runtime.dll
08/20/2024  02:34 PM            30,408 Microsoft.SharePoint.Client.Search.Applications.dll
08/20/2024  02:34 PM           138,816 Microsoft.SharePoint.Client.Search.dll
08/20/2024  02:34 PM            92,432 Microsoft.SharePoint.Client.Taxonomy.dll
08/20/2024  02:34 PM           181,968 Microsoft.SharePoint.Client.UserProfiles.dll
08/20/2024  02:34 PM            54,416 Microsoft.SharePoint.Client.WorkflowServices.dll
10/22/2021  06:40 PM            26,224 Microsoft.Win32.SystemEvents.dll
03/17/2021  03:03 PM           695,336 Newtonsoft.Json.dll
09/26/2024  09:29 AM                 0 output.txt
08/16/2024  06:24 AM         2,518,448 PnP.Core.dll
08/16/2024  06:41 AM        11,162,672 PnP.Framework.dll
10/29/2020  06:07 AM           259,072 Portable.Xaml.dll
09/24/2024  11:26 AM    <DIR>          runtimes
09/25/2024  08:14 PM            96,506 SharePointListCreation.deps.json
09/25/2024  08:14 PM            81,920 SharePointListCreation.dll
09/25/2024  08:14 PM           151,040 SharePointListCreation.exe
09/25/2024  08:14 PM            35,328 SharePointListCreation.pdb
09/25/2024  08:14 PM               253 SharePointListCreation.runtimeconfig.json
08/19/2022  02:58 PM           396,424 System.Configuration.ConfigurationManager.dll
02/15/2023  07:32 PM           145,072 System.Diagnostics.DiagnosticSource.dll
10/22/2021  06:51 PM           130,664 System.DirectoryServices.dll
10/22/2021  06:49 PM           175,216 System.Drawing.Common.dll
08/21/2024  11:16 PM            90,168 System.IdentityModel.Tokens.Jwt.dll
10/22/2021  06:49 PM           122,480 System.IO.Packaging.dll
10/22/2021  06:51 PM            20,592 System.Security.Cryptography.ProtectedData.dll
10/22/2021  06:49 PM           104,048 System.Security.Permissions.dll
10/23/2022  12:54 PM           457,856 System.Text.Json.dll
10/22/2021  06:49 PM            25,712 System.Windows.Extensions.dll
02/12/2023  03:28 PM            33,792 TimeZoneConverter.dll
              67 File(s)     33,235,103 bytes
               3 Dir(s)  702,420,926,464 bytes free
c# dll .net-6.0
1个回答
0
投票

要解决 .NET 6.0 控制台应用程序在服务器上运行时缺少 .DLL 的错误,您有两个主要选项:

独立部署:这会将 .NET 运行时和所有必需的 DLL 与应用程序打包在一起。

  • 在 Visual Studio 中:右键单击项目 → 发布 → 文件夹 → 部署模式:自包含 → 发布。

这将包括在任何计算机上运行应用程序所需的一切。

框架相关部署:如果服务器已安装.NET 6.0。

  • 作为依赖于框架的方式发布。确保服务器具有所需的 .NET 6.0 运行时。

独立部署确保在任何机器上都不会丢失依赖项。

© www.soinside.com 2019 - 2024. All rights reserved.