LGHT0132 Adding Json.Net to GAC with Wix

2

I'm building a Wix installer that is adding json.net to the GAC (I know... GAC bad, but orders are orders). During the build I get this error:

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

The json.net I'm using is for .NET 4. If I use json.net for .NET 2 it builds fine, no problems at all.

My registration is as simple as this:

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

I'm using Wix 3.5. Any ideas would be appreciated.

installation
wix
windows-installer
asked on Stack Overflow Apr 15, 2013 by Gabe Perez

1 Answer

2

I just tested this against WiX v3.8 and it works fine for me. I'm not aware of any changes in that part of the WiX toolset since v3.5 RTM'd. Error 0x8013101b means "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded". That almost certainly means that the WiX toolset is running on CLR2 and cannot read the CLR4 assemblies.

Your light.exe.config file should look like the following:

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

Order is important. Try removing the v2.0.50727 line. That will force the WiX toolset to only run on CLR4. If that fails, you'll want to investigate your environment.

answered on Stack Overflow Apr 15, 2013 by Rob Mensching

User contributions licensed under CC BY-SA 3.0