gpt4 book ai didi

.net-core-2.2 - 是否可以在 .net core 2.2 中发布单个 EXE 文件

转载 作者:行者123 更新时间:2023-12-04 01:03:23 26 4
gpt4 key购买 nike

基于 .net core 2.2 构建的项目。想要发布单个 EXE 文件。无法发布为单个 EXE 文件。

我在程序包控制台中尝试了以下命令

dotnet publish -r win-x64 -c Release/p:PublishSingleFile=true

    Restore completed in 995.93 ms for C:\Demo\New   
folder\BHHS\Importer\Importer.csproj.
You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
Importer -> C:\Demo\New folder\BHHS\Importer\bin\Release\netcoreapp2.2\win-x64\Importer.dll
C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018: The "GenerateBundle" task failed unexpectedly.[C:\Demo\New
folder\BHHS\Importer\Importer.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview8-
013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018:
Microsoft.NET.HostModel.AppHost.PlaceHolderNotFoundInAppHostException:
Exception of type
'Microsoft.NET.HostModel.AppHost.PlaceHolderNotFoundInAppHostException'
was thrown. [C:\Demo\New folder\BHHS\Importer\Importer.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018: at Microsoft.NET.HostModel.AppHost.BinaryUtils.SearchAndReplace(MemoryMappedViewAccessor accessor, Byte[] searchPattern, Byte[] patternToReplace, Boolean pad0s) [C:\Demo\New folder\BHHS\Importer\Importer.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018: at Microsoft.NET.HostModel.AppHost.BinaryUtils.SearchAndReplace(String filePath, Byte[] searchPattern, Byte[] patternToReplace, Boolean pad0s) [C:\Demo\New folder\BHHS\Importer\Importer.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018: at Microsoft.NET.HostModel.AppHost.HostWriter.SetAsBundle(String appHostPath, Int64 bundleHeaderOffset) [C:\Demo\New folder\BHHS\Importer\Importer.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018: at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [C:\Demo\New folder\BHHS\Importer\Importer.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018: at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() in /_/src/Tasks/Microsoft.NET.Build.Tasks/GenerateBundle.cs:line 36 [C:\Demo\New folder\BHHS\Importer\Importer.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() in /_/src/Tasks/Common/TaskBase.cs:line 38 [C:\Demo\New folder\BHHS\Importer\Importer.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Demo\New folder\BHHS\Importer\Importer.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(807,5):
error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Demo\New folder\BHHS\Importer\Importer.csproj]

最佳答案

没有。这仅适用于 .NET Core 3.0 及更高版本。在此处查看详细信息 - https://devblogs.microsoft.com/dotnet/announcing-net-core-3-0-preview-5/

Scott Hanselman 也有一篇关于它的博文 - https://www.hanselman.com/blog/MakingATinyNETCore30EntirelySelfcontainedSingleExecutable.aspx

关于.net-core-2.2 - 是否可以在 .net core 2.2 中发布单个 EXE 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57685471/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com