Skip to content

The type 'LogLevel' exists in both 'Device.Net and 'Microsoft.Extensions.Logging' #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pluto-dev opened this issue Dec 8, 2021 · 3 comments

Comments

@pluto-dev
Copy link

I get this error.

Error CS0433: The type 'LogLevel' exists in both 'Device.Net, Version=4.2.1.0, Culture=neutral, PublicKeyToken=null' and 'Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

devenv_qK8bjNXFUs

Why are they sharing the same namespace?

Info
Platform: Windows C# .net 4.7.2
Device Type: Hid
Version: 4.2.1

@NFran30
Copy link

NFran30 commented Feb 18, 2022

Is there a way to rectify this while staying with .NET Framework 4.7.2? I am not able use .NET Core

@MaverickMartyn
Copy link

I've run into this issue as well. Any workarounds?
Has this project been abandoned? I don't see any activity in the past 18 months. :/
I am stuck on .NET 4.7 until .NET 7 drops, due to a known framework issue currently being fixed.

@vnau
Copy link

vnau commented Sep 4, 2023

A workaround for this case is to change an alias of the assembly in the project file:

<Target Name="ChangeAliasesOfStrongNameAssemblies" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
    <ItemGroup>
      <ReferencePath Condition="'%(FileName)' == 'Microsoft.Extensions.Logging.Abstractions'">
        <Aliases>MELA</Aliases>
      </ReferencePath>
    </ItemGroup>
  </Target>

After that there would be no conflict and you can use aliased types in your code like this:

extern alias MELA;

using MelaLogLevel = MELA::Microsoft.Extensions.Logging.LogLevel;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants