问题描述
我正尝试将我们的网站从.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
TimeZoneInfo tzi = !calendarItem.UseUserTimeZone ? user.Settings.TimeZoneInfo : l.TimeZoneItem.Info;
在该行代码上,错误均显示在类型为"System.TimeZoneInfo
"的".TimeZoneInfo
"和".Info
"上.
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之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!