這是一個奇怪的。瘋狂VS設計師錯誤
重命名一個類後,我的一個表單開始給我設計師的錯誤,拒絕打開。有趣的是,當我運行程序時,表單工作得很好。
我開始恢復我的更改以推導出問題。我現在已完全恢復到最後一次提交 - 其中知道表單在設計器中工作 - 清理解決方案,並刪除bin /和obj /文件夾,以及* .suo文件以獲得更好的度量。
窗體仍然不顯示在設計器中。
下面是它給人的錯誤:
- Could not find 'MyNamespace.MyControl'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.
- The variable 'myControl1' is either undeclared or was never assigned.
的變量都宣佈和分配,以及MyControl建立精細(再次,窗體時程序實際運行正常工作)。更奇怪的是,如果我嘗試創建一個新的形式,並將一個MyControl到它,我得到這個實體框架錯誤:
Failed to create component 'MyControl'. The error message follows: 'System.ArgumentException: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid. at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.EntityClient.EntityConnection..ctor(String connectionString) at System.Data.Objects.ObjectContect.CreateEntityConnection(String connectionString) etc. etc.
有什麼錯我的連接字符串:它的工作之前,並再次, 它在我實際運行程序(該控件已經存在於上一次提交的舊窗體上)時起作用。
任何想法任何?我完全不知所措。
[編輯] 唯一顯著代碼:
MyControl.cs
public MyControl()
{
_entities = new MyEFEntities(); //Entity-framework generated class
}
MyForm.Designer.cs
private void InitializeComponent()
{
this.myControl1 = new MyNamespace.MyControl();
...
this.Controls.Add(this.myControl1);
}
MyEFDatabase.Designer.cs
public MyEFEntities() : base("name=MyEFEntities", "MyEFEntities") { ... }
App.Config
<connectionStrings>
<add name="MyEFEntities" connectionString="metadata=res://*/MyEFDatabase.csdl|res://*/MyEFDatabase.ssdl|res://*/MyEFDatabase.msl;provider=System.Data.SqlClient;provider connection string="Data Source=MyDatabaseServer;Initial Catalog=MyDatabase;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
我已經試過「替換"
與'
」絕招 - 沒有幫助。
[EDIT2]這是發生在新項目也有,但是不會立即進行。只有在擺弄了一下之後(這與添加EF自己無法解決的多對一關係有關),但我無法弄清楚重現的確切步驟。
通常遇到這種情況時我只需重新啓動VS和錯誤隨風 – Luiscencio 2010-03-16 17:31:26
沒有運氣走開 - 剛剛完成重新啓動我的電腦,它仍然發生。 – 2010-03-16 17:36:56
mmmm my next guess = P .... are namespaces OK? – Luiscencio 2010-03-16 17:39:45