VisualStudio2010およびOutlookAddin2010プロジェクト(.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.
これは、コードが.NET 4を対象としている場合に、フォーム領域またはリボンのプロパティを変更したときに実際に発生します。.NET3.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);
}
エラーを無視してVSにビジュアルエディターをロードさせると、別のエラーが発生します。
Cannot open a designer for the file because the class within it does not inherit
from a class that can be visually designed.
最初はコードに問題がありますが(プロジェクトをVS2008とOutlook 2007から移行しました)。しかし、その後、VS2010とOutlook 2010の新しいプロジェクトを作成しましたが、同じ問題が発生しています。
それを再現する手順:
- Visual Studio 2010(.NET 4)で新しいOutlook2010アドインプロジェクトを作成する
- プロジェクトに新しいFormRegionアイテムを追加します(どのアイテムを有効にするかは関係ありません。また、隣接するフォーム領域か別のフォーム領域かは関係ありません)
- 新しいアイテムのプロパティを開き、プロパティをに変更
Localizable
しますtrue
- アイテムを閉じて再度開きます