【发布时间】:2019-03-08 16:54:31
【问题描述】:
我将 dll 安装到 GAC 甚至更新了 dll 以将其安装到 GAC 但我收到此错误:
“无法加载文件或程序集 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 或其依赖项之一。系统找不到指定的文件。”:“Newtonsoft.Json,版本=4.5.0.0,文化=中性,PublicKeyToken=30ad4fe6b2a6aeed"}
App.config
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
GAC 位置:
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_12.0.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll
我也将 dll 复制到了 C:\Windows\System32,但是当我尝试从这个位置添加它作为参考时,Visual Studio 看不到它。
【问题讨论】:
-
您是在本地运行还是通过服务器/目录运行?从服务器运行时,它需要在服务器 GAC 中。要检查的另一件事是 64 位与 32 位运行时。
-
@JoeC 现在在本地运行。