DataDirectory seems to have been corrupted and Forms Designer is getting confused.
I've been working on a little project using Orcas (as a test) for a while with no problems. It's Windows Forms-based with a simple MDF database (created using Orcas) that attaches at run-time. Now, seemingly all of a sudden, when I try to open the main form to design some more I get two errors.
- An attempt to attach an auto-named database for file C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\BAGSTracker.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
and
- The variable 'MainProjectForm1' is either undeclared or was never assigned.
The connection string to the database is using |DataDirectory| so for some reason the Form Designer is expanding that to it's folder and not the application folder... rather annoying. As for the second error... here's an extract from the MainForm.Designer.cs
///<summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor.///</summary>privatevoid InitializeComponent(){
this.components =new System.ComponentModel.Container();System.ComponentModel.
ComponentResourceManager resources =new System.ComponentModel.ComponentResourceManager(typeof(MainForm));this.toolStripContainer1 =new System.Windows.Forms.ToolStripContainer();this.splitContainer1 =new System.Windows.Forms.SplitContainer();this.ProjectList =new System.Windows.Forms.ListBox();this.bindingSource1 =new System.Windows.Forms.BindingSource(this.components);this.dAL =new BAGSTracker.DataLayer.DAL();this.MainProjectForm1 =newProjectForm();...this.splitContainer1.Panel2.Controls.Add(this.MainProjectForm1);
...
}
I've extracted some of the lines for brevity but as you can see MainProjectForm1 is not only declared but also assigned and in the same function as the line reporting the error. Now I'm guessing that the second error might be related to the first as it's the ProjectForm that actually accesses the database for the most part. ProjectForm is a UserControl. Anyone able to direct me to where |DataDirectory| is defined and how to change it at design-time as I suspect a corrupt project file somewhere.
Cheers,
Brian

