C# Error quot;Is not supported by the languagequot; after migration to .Net4(C# 错误“语言不支持迁移到 .Net4 后)
问题描述
我正在尝试将我们的网站从 .Net 3.5 迁移到 4,但遇到了一个非常奇怪的问题.
I'm trying to migration our website from .Net 3.5 to 4 and I'm encountering a very weird issue.
一旦我以 .Net4 为目标,在 3.5 中运行良好的代码就不再存在,这给了我错误
Code that works just fine in 3.5 does not anymore once I target .Net4, giving me the error
该语言不支持xxx".
"xxx is not supported by the language".
TimeZoneInfo tzi = !calendarItem.UseUserTimeZone ? user.Settings.TimeZoneInfo : l.TimeZoneItem.Info;
在该行代码中,错误显示在.TimeZoneInfo
"和.Info
"两者的类型为System.TimeZoneInfo
".
On that line of code the error shows on ".TimeZoneInfo
" and ".Info
" both of type "System.TimeZoneInfo
".
user.Settings.TimeZoneInfo
属性的定义是:
public TimeZoneInfo TimeZoneInfo
{
get { return World.TimeZones[Convert.ToInt32(this[Setting.TimeZoneInfo])].Info; }
set { this[Setting.TimeZoneInfo] = value.ToTimeZoneItem().Id.ToString(); }
}
l.TimeZoneItem.Info
属性的定义是:
public TimeZoneInfo Info
{
get { return info; }
}
不太清楚这里发生了什么.请在这方面寻求帮助.
Not really sure what's going on here. Need help on that one please.
推荐答案
可能是程序集不一致问题.当我想使用一个为另一个项目创建循环引用的程序集时,我遇到了这个问题.一旦我修复了这个循环引用问题,错误就不再出现了.
It's probably an assembly inconsistency issue. I had this problem when I wanted to use an assembly that created a circular reference with another project. Once I fixed this circular reference issue, the error didn't appear anymore.
这篇关于C# 错误“语言不支持"迁移到 .Net4 后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C# 错误“语言不支持"迁移到 .Net4 后


- C#MongoDB使用Builders查找派生对象 2022-09-04
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 输入按键事件处理程序 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01