添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
火星上的紫菜汤  ·  LXD ...·  6 月前    · 
性感的大象  ·  msbuild - ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Visual Studio: [CS0433] type Func<T, TResult> exists in both <System.Core (3.5.0.0)> and <mscorlib (4.0.0.0)>

Ask Question

I've been having quite a few struggles with Visual Studio lately but I just can't fix this one out. When trying to rebuild my project I get:

Error CS0433: The type 'Func' exists in both 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

The only thing that seemed to work was to manually add a reference to the csproj file.

<Reference Include="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"/>

Which leaves me with a new error:

Error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll' and 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Remove one of the duplicate references.

Now the 3.5.0.0 reference is not found in the project but can be seen in the Object Browser with no option to remove it:

In an app.config file I also tried to redirect the reference to the newer version:

<dependentAssembly>
    <assemblyIdentity name="System.Core" publicKeyToken="b77a5c561934e089" culture="neutral" />
    <bindingRedirect oldVersion="3.5.0.0" newVersion="4.0.0.0" />
</dependentAssembly>

Which doesn't change a thing.

I'd appreciate any ideas or input as I've been searching and struggling with this for over a week.

What if you just try to use the newer version rather than redirecting? It seems likely the moved it from one to the other between 3.5 and 4.0. – ProgrammingLlama Feb 1, 2019 at 5:41 Those aren't just any assemblies. They are runtime files. Somehow, somewhere your code is referencing an assembly built for the .NET 3.5 runtime. You should replace them with newer versions - .NET 4.0 came out in 2010. Most likely the author of that assembly released an updated version since, or abandoned it altogether – Panagiotis Kanavos Feb 1, 2019 at 8:00 Are you using outdated Windows Workflow or WPF assemblies perhaps? Do you use an old third-party library to connect to a remote service? .NET 3.5 is the .NET 2.0 runtime with the addition of WF, WPF and WCF. All those were upgraded in .NET 4.0 and later so you should be able to find a newer library – Panagiotis Kanavos Feb 1, 2019 at 8:05

Its such a pain to figure out this problem. After hitting my head for hours, finally I found the problem with the "3.5" version of system.core.dll. So, I copied the "4.0.." version of "system.core.dll" from Program Files (X86) folder to my References or Bin folder of the Application. For me it was under(C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5). Also, if needed, manually add a reference to the csproj file as mentioned in the Original Question. Hope it helps. Sigh :)

Thanks for your answer but if I remember correctly that didn't help either. I eventually fixed it with clearing the entry in the GAC (Global Assembly Cache). – a bad coder May 25, 2020 at 18:49

open windows control panel > programs and features > turn windows features on or off, and disable .Net Framework 3.5. video

this way works for me.

public delegate T MyFunc<T1, T>(T1 item); public delegate T MyFunc<T1, T2, T>(T1 item1, T2 item2);

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.