WIX adding dll reference picking wrong version

0
<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
         <Component Id="ProductComponent" Guid="b21e914c-3c08-4876-b825-9a15f273091b"> 
     <File Source="$(var.LenderService.TargetPath)" />
     <File Id="Microsoft.Owin.Hosting" Name="Microsoft.Owin.Hosting.dll" Vital="yes" KeyPath="no" DiskId="1" Source="..\LenderService\LenderService\bin\Release\Microsoft.Owin.Hosting.dll" />
     <File Id="Microsoft.Owin" Name="Microsoft.Owin.dll" Vital="yes" KeyPath="no" DiskId="1" Source="..\LenderService\LenderService\bin\Release\Microsoft.Owin.dll" />
     <File Id="Owin" Name="Owin.dll" Vital="yes" KeyPath="no" DiskId="1" Source="..\LenderService\LenderService\bin\Release\Owin.dll" />
     <File Id="Microsoft.Owin.Host.HttpListener" Name="Microsoft.Owin.Host.HttpListener.dll" Vital="yes" KeyPath="no" DiskId="1" Source="..\LenderService\LenderService\bin\Release\Microsoft.Owin.Host.HttpListener.dll" />
     <File Id="System.Web.Http" Name="System.Web.Http.dll" Vital="yes" KeyPath="no" DiskId="1" Source="..\LenderService\LenderService\bin\Release\System.Web.Http.dll" />
     <File Id="System.Web.Http.Owin" Name="System.Web.Http.Owin.dll" Vital="yes" KeyPath="no" DiskId="1" Source="..\LenderService\LenderService\bin\Release\System.Web.Http.Owin.dll" />
     <File Id="System.Net.Http.Formatting" Name="System.Net.Http.Formatting.dll" Vital="yes" KeyPath="no" DiskId="1" Source="..\LenderService\LenderService\bin\Release\System.Net.Http.Formatting.dll" />
     <File Id="Newtonsoft.Json" Name="Newtonsoft.Json.dll" Vital="yes" KeyPath="no" DiskId="1" Source="..\LenderService\LenderService\bin\Release\Newtonsoft.Json.dll" />
     <ServiceInstall
        Id="ServiceInstaller"
        Type="ownProcess"
        Vital="yes"
        Name="LenderPortalService"
        DisplayName="Lender Portal Service"
        Description="COBOL Service"
        Start="auto"
        Account="LocalSystem"
        ErrorControl="ignore"
        Interactive="no"
        />
     <!--<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="JobService" Wait="yes" />-->
         </Component> 
    </ComponentGroup>
</Fragment>

i have this wix Poduct.wxs to create a windows service which is creating it fine but when i start the service i just stops with a generic error 'Service started and then stopped'. When i check windows event under Application i see the error given by the service that says 'Service cannot be started. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'. if you notice i have Newtonsoft.Json listed as a dependency of the project, but the version of Newtonsoft.Json installed is 10.0.0 which is in my app.config like

'<dependentAssembly>            
  <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" 
  culture="neutral" />            
  <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>          </dependentAssembly>'

and package.json

'<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />'

however if you notice the service is looking for version 6.0.0.

Any idea what could be the reason? Thank you.

visual-studio-2015
wix
json.net
asked on Stack Overflow Jul 3, 2017 by Lexy Feito

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0