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 后
基础教程推荐
- WPF 模态进度窗口 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
