English 中文(简体)
Changing any Form Region/Ribbon property breaks Visual Studio editor
原标题:

I have a problem with Visual Studio 2010 and Outlook Addin 2010 project (.NET 4 target). I ve added a form region to my project and then I ve changed Localizable property to true. Now if I close my form region and reopen it, I m getting this VS error page:

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.

This actually happens when I change any property in Form Region or Ribbon if the code is targeted for .NET 4. In projects targeted for .NET 3.5 everything is in order. Here s the example code that this error refers to was created by VS and it s a part of FormRegion.Designer.cs. It breaks on ApplyResources line (if I comment it out then everything is ok).

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);
}

If I choose to ignore the error and force VS to load visual editor then I m getting another error:

Cannot open a designer for the file because the class within it does not inherit 
from a class that can be visually designed. 

At first I though it s a problem with my code (I have my project migrated from VS2008 and Outlook 2007). But then I created a new project for VS2010 and Outlook 2010 and I have the same problem there.

Steps to reproduce it:

  1. Create a new Outlook 2010 Addin project in Visual Studio 2010 (.NET 4)
  2. Add a new FormRegion item to a project (it doesn t matter for which item you enables it, it also doesn t matter if it s adjoined or separate form region)
  3. Open new item properties and change Localizable property to true
  4. Close item and reopen it
问题回答

暂无回答




相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签