strange warning about ExtensionAttribute

后端 未结 6 702
旧时难觅i
旧时难觅i 2020-12-15 16:23

I\'m getting a strange warning:

The predefined type \'System.Runtime.CompilerServices.ExtensionAttribute\' is defined in multiple assemblies in the gl

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-15 16:46

    I agree with ShuggyCoUk that the best course of action is to try to remove the offending dll. That may not be possible, though.

    Another way to resolve the ambiguity that the compiler is complaining about is to change the Alias of the referenced dll. In your project, in the References folder, if you click on a referenced dll you will see the Aliases property. By default, this is "global", which allows you to do things like "global::SomeNamespace.SomeType". You might simply be able to change the alias to something else.

    This fixed a problem I had where I needed to reference Microsoft.Scripting.Core.dll, but it contained some types that conflicted with mscorlib.dll. I changed the Aliases property to be "ThirdParty" instead of "global", and that fixed the warning.

提交回复
热议问题