installation - LGHT0132 使用 Wix 将 Json.Net 添加到 GAC

标签 installation wix windows-installer

我正在构建一个 Wix 安装程序,将 json.net 添加到 GAC(我知道……GAC 很糟糕,但命令就是命令)。在构建过程中我收到此错误:

error LGHT0132: The assembly file 'path\Newtonsoft.Json.dll' appears to be invalid. Please ensure this is a valid assembly file and that the user has the appropriate access rights to this file. More information: HRESULT: 0x8013101b

我使用的 json.net 适用于 .NET 4。如果我使用 json.net 适用于 .NET 2,它构建得很好,完全没有问题。

我的注册就像这样简单:

<Component Id="newtonsoft.json.gac.comp" Directory="GAC">
    <File Id="newtonsoft.json.gac.file" KeyPath="yes" Assembly=".net" Source="path\Newtonsoft.Json.dll" />
</Component>

我使用的是 Wix 3.5。任何想法将不胜感激。

最佳答案

我刚刚针对 WiX v3.8 进行了测试,它对我来说效果很好。自 v3.5 RTM 以来,我不知道 WiX 工具集的这一部分有任何变化。错误0x8013101b表示“该程序集是由比当前加载的运行时更新的运行时构建的,无法加载”。这几乎肯定意味着 WiX 工具集在 CLR2 上运行,无法读取 CLR4 程序集。

您的 light.exe.config 文件应如下所示:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" />
    <supportedRuntime version="v2.0.50727" />
  </startup>
</configuration>

顺序很重要。尝试删除 v2.0.50727 行。这将强制 WiX 工具集仅在 CLR4 上运行。如果失败,您将需要调查您的环境。

关于installation - LGHT0132 使用 Wix 将 Json.Net 添加到 GAC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16025235/

相关文章:

wix installer 3.7 bootstrapper 注册表搜索

powershell - 如何找到已安装的MSI设置的产品GUID?

installation - 提取 msi 时出现错误 2203

Python3 : ImportError: No module named '_ctypes' when using Value from module multiprocessing

wix 安装程序失败错误代码 2819

xcode - "Monotouch is not installed"错误

wix - 如何在自定义 Bootstrap 应用程序中设置或获取所有日志

PostgresQL Windows 安装程序 - 空白屏幕 -

c# - .NET 软件更新管理器

iphone - iPhone 上的 adhoc 应用程序安装失败,为什么?