gpt4 book ai didi

c# - Visual Studio : [CS0433] type Func 存在于

转载 作者:行者123 更新时间:2023-12-05 05:12:32 25 4
gpt4 key购买 nike

最近我在使用 Visual Studio 时遇到了很多问题,但我就是无法解决这个问题。尝试重建我的项目时,我得到:

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'

似乎唯一可行的方法是手动添加对 csproj 文件的引用。

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

这给我留下了一个新的错误:

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.

现在在项目中找不到 3.5.0.0 引用,但可以在对象浏览器中看到,没有删除它的选项:

Object Browser

在 app.config 文件中,我还尝试将引用重定向到较新的版本:

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

这不会改变任何事情。

我将不胜感激任何想法或意见,因为我已经搜索并为此奋斗了一个多星期。

最佳答案

弄清楚这个问题真是太痛苦了。苦思冥想数小时后,我终于发现了 system.core.dll 的“3.5”版本的问题。因此,我将“system.core.dll”的 “4.0..” 版本从 Program Files (X86) 文件夹复制到应用程序的 References 或 Bin 文件夹中。对我来说,它位于 (C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5) 下。此外,如果需要,请手动添加对原始问题中提到的 csproj 文件的引用。希望能帮助到你。叹息:)

关于c# - Visual Studio : [CS0433] type Func<T, TResult> 存在于 <System.Core (3.5.0.0)> 和 <mscorlib (4.0.0.0)> 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54473451/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com