RaY*_*ell 5 .net vsto visual-studio-2010 outlook-addin outlook-2010
我有Visual Studio 2010和Outlook Addin 2010项目(.NET 4目标)的问题.我已经在我的项目中添加了一个表单区域,然后我将Localizable
属性更改为true.现在,如果我关闭我的表单区域并重新打开它,我将收到此VS错误页面:
To prevent possible data loss before loading the designer, the following errors
must be resolved:
The variable 'resources' is either undeclared or was never assigned.
Run Code Online (Sandbox Code Playgroud)
如果代码是针对.NET 4的,那么当我更改表单区域或功能区中的任何属性时,实际上会发生这种情况.在针对.NET 3.5的项目中,一切都是有序的.这个错误引用的示例代码是由VS创建的,它是其中的一部分FormRegion.Designer.cs
.它打破了ApplyResources
(如果我发表评论,那么一切都好).
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources =
new System.ComponentModel.ComponentResourceManager(typeof(FormRegion1));
this.SuspendLayout();
//
// FormRegion1
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "FormRegion1";
this.FormRegionShowing +=
new System.EventHandler(this.FormRegion1_FormRegionShowing);
this.FormRegionClosed +=
new System.EventHandler(this.FormRegion1_FormRegionClosed);
this.ResumeLayout(false);
}
Run Code Online (Sandbox Code Playgroud)
如果我选择忽略错误并强制VS加载可视化编辑器,那么我会收到另一个错误:
Cannot open a designer for the file because the class within it does not inherit
from a class that can be visually designed.
Run Code Online (Sandbox Code Playgroud)
起初我虽然这是我的代码的问题(我的项目从VS2008和Outlook 2007迁移).但后来我为VS2010和Outlook 2010创建了一个新项目,我遇到了同样的问题.
重现它的步骤:
Localizable
为true
归档时间: |
|
查看次数: |
754 次 |
最近记录: |