開啟現成專案,其中WebForm中已使用某自訂控制項,從工具箱拖了同一DLL的其他控制項到WebForm中,出現:

Error creating template groups. Reason: System.InvalidCastException: [A]Boo.Web.MyGrid cannot be cast to [B]Boo.Web.MyGrid. Type A originates from 'Boo.Web.UI, Version=3.5.0.0, Culture=neutral, PublicKeyToken=123256789abcdef0’ .' in the context 'LoadNeither' at location 'C:\Users\jeffrey\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies\yb6ywnfj01\Boo.Web.UI.dll'. Type B originates from 'Boo.Web.UI, Version=3.5.0.0, Culture=neutral, PublicKeyToken=123256789abcdef0’ in the context 'LoadNeither' at location 'C:\Users\jeffrey\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies\t4xemrmv01\boo.web.ui.dll'.

在設計檢視下,控制項呈現破損狀態無法編輯。仔細看錯誤訊息,發現Strong Name 'Boo.Web.UI, Version=3.5.0.0, Culture=neutral, PublicKeyToken=123256789abcdef0’相同,但是暫存路徑不同(綠色部分),在VS2008/VS2010都摔過跤的同事提供血淚經驗,我先刪除bin目錄下的Boo.Web.UI.dll及Boo.Web.UI.Design.dll,重新拖入元件,控制項仍無法顯示,但破損控制項按右鍵叫出選單,執行”重新整理"(Refresh),問題排除。以上經驗供參考。


Comments

Be the first to post a comment

Post a comment


60 - 36 =