zoukankan      html  css  js  c++  java
  • Nuget版本冲突的问题

    有两个类库项目,一个引用了比如Newtonsoft.Json 6.0, 另一个引用了比如Newtonsoft.Json 8.0, 然后另一个exe项目同时引用了这两个类库项目。

    那么在编译的时候会报warning:

    No way to resolve conflict between "Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily.

    Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "6.0.0.0" [DllProject1inReleaseNewtonsoft.Json.dll] to Version "8.0.0.0" [DllProject2inReleaseNewtonsoft.Json.dll] to solve conflict and get rid of warning.

     

    然后exe在运行的时候会报错:

    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.

     

    【解决方法】

    在exe项目的app.config加入如下的配置:

    <runtime>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

    <dependentAssembly>

    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />

    <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />

    </dependentAssembly>

    </assemblyBinding>

    </runtime>

     

  • 相关阅读:
    ios 视频旋转---分解ZFPlayer
    IOS lame库 pcm转mp3 分析(方案二)
    IOS lame库 pcm转mp3 分析(方案一)
    ios 动态库合成包(真机&模拟器)脚本
    lame 制作ios静态库
    React Native scrollview 循环播放
    React Native Image多种加载图片方式
    汉字转拼音(包含多音字)
    React Native Alert、ActionSheet
    React Native Picker (城市选择器)
  • 原文地址:https://www.cnblogs.com/time-is-life/p/6097994.html
Copyright © 2011-2022 走看看