NickCraver / StackExchange.Exceptional

Error handler used for the Stack Exchange network
https://nickcraver.com/StackExchange.Exceptional/
Apache License 2.0
859 stars 170 forks source link

Question: Dapper / Dapper.StrongName dependency #136

Open AkosLukacs opened 6 years ago

AkosLukacs commented 6 years ago

Hi!

Latest MiniProfiler.Providers.SqlServer depends on Dapper.StrongName package, this package depends on Dapper package. Any idea how to solve this now, or plans to change the dependency of this package to Dapper.StrongName?

Thanks!

lalibi commented 5 years ago

Same here, I get:

Error CS0121 The call is ambiguous between the following methods or properties: 'Dapper.SqlMapper.AsList(System.Collections.Generic.IEnumerable)' and 'Dapper.SqlMapper.AsList(System.Collections.Generic.IEnumerable)'

when I'm trying to use .AsList(), for instance, because both Dapper and Dapper.StongName are referenced.

@AkosLukacs Did you solve it?

AkosLukacs commented 5 years ago

Just rolled back to previous version :(

Nicholaos Bilalis notifications@github.com ezt írta (időpont: 2018. aug. 17., P 13:46):

Same here, I get:

Error CS0121 The call is ambiguous between the following methods or properties: 'Dapper.SqlMapper.AsList(System.Collections.Generic.IEnumerable)' and 'Dapper.SqlMapper.AsList(System.Collections.Generic.IEnumerable)'

when I'm trying to use .AsList(), for instance, because both Dapper and Dapper.StongName are referenced.

@AkosLukacs https://github.com/AkosLukacs Did you solved it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NickCraver/StackExchange.Exceptional/issues/136#issuecomment-413840426, or mute the thread https://github.com/notifications/unsubscribe-auth/AAziKzfucvs5gAosBXKEUI4xXthP3Lb4ks5uRq0WgaJpZM4U5p3- .

lalibi commented 5 years ago

Hey @AkosLukacs , I found a solution that worked for me. I added the following to my .csproj:

  <Target Name="ChangeAliasesOfStrongNameAssemblies" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
    <ItemGroup>
      <ReferencePath Condition="'%(FileName)' == 'Dapper.StrongName'">
        <Aliases>SomeAlias</Aliases>
      </ReferencePath>
    </ItemGroup>
  </Target>
NickCraver commented 5 years ago

Dapper v2 will do away with strong name (the only real solution for this...it's just a big one), but that will be later this year at the earliest. We've been busier than expected and StackExchange.Redis ate a lot more of our v2 time than we planned on. It's next on our list, though.

Tagged this as blocked for now to I keep an eye on it. As soon as we release Dapper v2, I'll release a new exceptional with the dependency to unblock upgrades and the scenario here.

mayerspitz commented 5 years ago

Thanks @lalibi, your solution is just what I've looked for.

dazbradbury commented 4 years ago

Is this now possible with the Dapper 2 release?

tonyqus commented 3 years ago

Looks MiniProfiler is still referencing Dapper.StrongName, which is not a popular nuget package at all. Instead, Dapper is the primary release. This makes it impossible for Dapper (not Dapper.StrongName) users to use MiniProfiler at all if they need to use MiniProfiler.Providers.XXX.

AkosLukacs commented 3 years ago

Anybody finding the same issue: @lalibi 's workaround does work, thanks for sharing!

shinelev commented 1 month ago

This workaround with alias helped me in 2024 :) Thanks!