“System.BadImageFormatException:”没有为此类型库注册包装程序集。
在System.Windows.Forms.Design.DocumentDesigner.AxToolboxItem.Create.ComponentsCore(IDesignerHost host)
在
System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host,IDictionary defaultValues)
在
System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host,IDictionary defaultValues)
在
System.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem tool,Control parent,Int32 x,Int32 y,Int32 width,int32 height,Boolean hasLocation,Boolean hasSize,ToolboxSnapDragDropEventArgs e)"
用delphiXE2 生成一个64位的ocx,在C#中调用,出现以上问题。
无法启动服务.System.BadImageFormatException: 不是有效的 Win32 应用程序。
是因为Microsoft Visual Studio应用是32位的,所以需引用delphixe2生成的32位ocx,。
设计时显示的是32位,运行后就自动调用64位了。(具体怎么转换的也不清楚)
找到以下资料,大概了解了一些。
if your design-time packages require that certain DLLs be loaded, you should remember that design-time packages can be only 32-bit and that is why they can load only 32-bit versions of these DLLs, while at run-time 64-bit versions of the DLLs will be loaded. Correspondingly, if there are only 64-bit versions of the DLL on your computer, you won’t be able to use all functions at design-time and, vice versa, if you have only 32-bit versions of the DLLs, your applications that are compiled for the 64-bit platform won’t be able to work at run-time.