使用场景是在Window7上运行一个ASP.Net Core程序,之前由于一些第三方库依赖,需要安装VS 2008 C++的库,所以就下载了微软C++库合集安装,然后就遇到了下面的错误:
An error occurred starting the application System.PlatformNotSupportedException: The native library 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\wminet_utils.dll' does not have all required functions. Please, update the .NET Framework.
   at System.Management.WmiNetUtilsHelper.<>c__DisplayClass104_0.<LoadPlatformNotSupportedDelegates>b__39(Int32 _, IntPtr __, APTTYPE& ___)
   at System.Management.MTAHelper.IsNoContextMTA()
   at System.Management.MTAHelper.CreateInMTA(Type type)
   at System.Management.ManagementPath.CreateWbemPath(String path)

错误分析,明显是由于Dll被旧的文件给覆盖了,导致一些引用函数不能使用,并且旧的dll就存在于Framework当中。所以解决思路就有了,重新安装一下 Framework就可以了。事实证明我的分析是正确的,重新安装后这个错误就没有了。

写在最后,重新安装Framework是说要安装4.8版本。