WIX添加dll引用挑错版本

时间:2017-07-03 13:16:42

标签: visual-studio-2015 wix json.net

<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>

我有这个wix Poduct.wxs来创建一个正常创建它的Windows服务但是当我启动服务时我只是停止了一般错误'服务启动然后停止'。当我检查应用程序下的Windows事件时,我会看到服务提供的错误'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)'。如果您注意到我将Newtonsoft.Json列为项目的依赖项,但安装的Newtonsoft.Json版本是10.0.0,这在我的app.config中就像

'<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>'

和package.json

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

但是,如果您注意到该服务正在寻找版本6.0.0。

任何想法可能是什么原因?谢谢。

0 个答案:

没有答案