【问题标题】:Why calling StrongNameSignatureVerificationEx requires .NET Fx 3.5 to be installed?为什么调用 StrongNameSignatureVerificationEx 需要安装 .NET Fx 3.5?
【发布时间】:2022-11-02 13:08:51
【问题描述】:

在未安装 .NET 3.5 的 Windows 10 或 11 机器上,调用 StrongNameSignatureVerificationEx() 要求 Windows 要求用户安装 .NET 3.5,为什么?是否可以绕过此对话框?或测试是否未安装 .NET 3.5?

using System;
using System.Runtime.InteropServices;

internal class Program {

   [DllImport("mscoree.dll", CharSet = CharSet.Unicode, SetLastError = true, EntryPoint = "StrongNameSignatureVerificationEx")]
   private static extern bool StrongNameSignatureVerificationEx(string wszFilePath,
                          byte fForceVerification,
                          ref byte pfWasVerified);
   static void Main(string[] args) {
      byte wasVerified = Convert.ToByte(false);
      byte forceVerification = Convert.ToByte(true);
      var bChecked = StrongNameSignatureVerificationEx(
         @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Collections.dll",
                       forceVerification,
                       ref wasVerified);
   }
}

【问题讨论】:

    标签: .net .net-4.8


    【解决方案1】:

    this discussion 看来,除了删除对StrongNameSignatureVerificationEx() 的调用外,无能为力。

    .NET Core 中不推荐使用强名称。没有强大的 API .NET Core 中的名称验证,并且运行时不会验证 强名称。

    【讨论】:

      猜你喜欢
      • 2010-10-20
      • 2015-11-07
      • 2010-12-15
      • 1970-01-01
      • 2014-02-06
      • 2011-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多