You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac下Asp.Net Core 5.0项目用PostSharp报NU3037签名过期错误求助

问题根因

NU3037错误为NuGet官方校验规则触发:对应包的仓库主签名有效期已过期,你遇到的报错是PostSharp依赖的旧版runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0包签名过期,同时搭配Mac环境下PostSharp运行时调用异常共同导致。

解决步骤

  • 临时关闭NuGet签名校验(快速验证)
    找到你用户目录下的~/.nuget/NuGet/NuGet.Config文件,在config节点下添加配置:
    <add key="signatureValidationMode" value="accept" />
    
    也可以执行全局命令设置:
    nuget config set signatureValidationMode accept
    
  • 清理所有缓存文件
    仅重装NuGet包无法解决缓存残留问题,需依次清理三类缓存:
    1. 清理NuGet全局缓存:执行命令 dotnet nuget locals all --clear
    2. 清理PostSharp本地缓存:直接删除报错提示的/var/tmp/postsharp/整个目录
    3. 清理项目编译缓存:删除解决方案下所有项目的bin、obj文件夹
  • 修复PostSharp Mac运行时配置
    PostSharp 6.9+版本已原生支持跨平台运行,无需单独下载Mac安装包,你之前下载的exe文件是Windows平台使用的,直接删除即可。在所有引用了PostSharp的项目.csproj文件的PropertyGroup节点中添加配置,强制使用.Net Core运行时启动PostSharp:
    <PostSharpHost>Core</PostSharpHost>
    
  • 显式升级过期依赖包
    你报错涉及的System.Security.Cryptography.OpenSsl 4.3.0为老旧版本,在所有项目中显式引用该包的4.7.0及以上稳定版,即可覆盖PostSharp传递引入的旧版本依赖。
  • 备选方案:降级PostSharp版本
    如果上述操作后仍有报错,可将PostSharp NuGet包降级到6.8.x稳定版,该版本跨平台兼容问题更少。

你提到的错误信息参考:
/var/tmp/postsharp/cache/DependencyRestore/5.0.400/net5.0-sdk5.0.400-osx-x64--ps6.9.8.0-bcb8619.deps.proj: Error NU3037: Package 'runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0' from source 'https://api.nuget.org/v3/index.json': The repository primary signature validity period has expired. (NU3037) (DevFramework.Northwind.Business.Tests)

内容的提问来源于stack exchange,提问作者Nurşen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.04 16:15:03