问题描述
我正在尝试将我们的网站从 .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 后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!