How to fix “No way to resolve conflict between” error?

后端 未结 4 601
-上瘾入骨i
-上瘾入骨i 2021-02-06 21:35

Recently added log4net.dll to our data object. Our data object builds perfectly but when you try to build anything that references our data object you get the following error: <

相关标签:
4条回答
  • 2021-02-06 21:53

    You will get this message as well when running a net framework v4.6.2 application that references netstandard2_0 libraries. Net462 does not fully support netstandard and thus quite some dlls are duplicated with different versions. Even if you don't reference something (e.g. System.Drawing) you might see conflicts. Consider upgrading to a higher net framework version (I've just changed to 4.7.2, which resolved this).

    0 讨论(0)
  • 2021-02-06 21:57

    Cause:

    You have two different assemblies with the same file name. The compiler does not know which one to choose to copy to the output directory so it gives that No way to resolve conflict between... error.

    In my case, they were completely different assemblies that happened to have the same file names.

    In your case, you have two different versions of the same assembly (log4net)

    solution:

    In my case, the solution was to simply rename one of the dll files.

    In your case, the solution is to find out where the older assembly was referenced and correct it to reference the newer one.

    0 讨论(0)
  • 2021-02-06 22:01

    Open your project file (.csproj in C# or .vbproj in VB.NET) for editing.

    Make sure the log4net reference is Fully Qualified Type Name, has HintPath and SpecificVersion=True.

    <Reference Include="log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
      <HintPath>..\references\log4net.dll</HintPath>
      <SpecificVersion>True</SpecificVersion>
    </Reference> 
    

    Save the file and try to rebuild.

    0 讨论(0)
  • 2021-02-06 22:01

    We found out that crystal runtime was definitely the problem. If we uninstall log4net at %windir%\assembly that crystal runtime installed then the warning message goes away. What's weird is that if I install log4net 1.2.10 from log4net's site into the GAC then the warning message doesn't reappear. If anyone can explain that then please add to this thread. Crystal signed log4net with their own strong name key (the public key token is different).

    The key to fixing the log4net problem is that log4net is a open source project. Which means we can simply build the dll from source with a different name. Haven't tried it out yet but that should fix the problem. We'll have the extra step of building from source every time we want to update log4net but considering how much we are going to update the dll it isn't a big deal.

    0 讨论(0)
提交回复
热议问题