asp.net - asp.NET 核心发布 Trimmed 退出,错误代码为 -532462766
问题描述
我正在尝试通过命令行发布我的 asp.net-core 应用程序并使用“PublishedTrimmed”功能。
我都试过了
dotnet build -c Release './project.csproj' /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
和
dotnet publish -c Release './project.csproj' -o "outputPath"
build 命令中使用的发布配置文件如下所示:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<ProjectGuid>1b763e24-74f7-453c-bf79-210861cd0fd7</ProjectGuid>
<publishUrl>[redacted]</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<PublishSingleFile>False</PublishSingleFile>
<PublishTrimmed>True</PublishTrimmed>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
为了使用发布命令,我将相关代码添加到 csproj 文件中,如下所示:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
<PublishSingleFile>True</PublishSingleFile>
<PublishTrimmed>True</PublishTrimmed>
</PropertyGroup>
</Project>
可悲的是,我所做的所有尝试都导致了同样的错误:
C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(83,5): error MSB6006: "dotnet.exe" has exited with error code -532462766。
如果我在 Visual Studio 2019 中使用内置发布按钮,也会发生这种情况
我目前只安装了 v.3.1.101 (x64) .net-core SDK,它在不使用“PublishTrimmed”时可以正确构建和发布
错误消息并没有真正帮助我,所以谁能告诉我为什么会发生这个错误以及如何解决这个问题?
谢谢!
解决方案
推荐阅读
- ios - 添加新注释后,我的第一次点击没有处理,但第二次点击是
- angular - 离子 - 被 CORS 政策阻止:没有“访问控制允许来源”
- python - 从一组打印一个项目时,这条额外的线来自哪里?(CSV) 文件使用 Python 和 Spyder4
- ruby-on-rails - Rails 5:API 参数结合了两个值
- c# - 在进行 http 客户端请求调用之前如何验证用户代理是否正确?
- python - 如何对代码的数值近似进行错误分析?
- ocaml - 为什么类型推断算法会因为“Fun.flip Option.bind”而混淆?
- grafana - 有什么方法可以从数据库中获取 grafana 仪表板时间范围“时间线”
- bash - 检查域可用性——避免抢占先机——使用通配符或正则表达式
- matlab - LMI 变量在 LMI 解析后为空