我知道这个问题已被多次回答,但我已尝试过所有先前建议的解决方案。
1。)目标CPU是x86
2.。)我已经注册了ocx和dll文件
应用程序在旧机器(所有操作系统)上运行良好,但在新映像上没有。
这是日志:
框架版本:v4.0.30319描述:该过程已终止 由于未处理的异常。例外信息: System.Runtime.InteropServices.COMException at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(的System.Guid ByRef,System.Object,Int32,System.Guid ByRef)at System.Windows.Forms.AxHost.CreateWithLicense(System.String, System.Guid)at System.Windows.Forms.AxHost.CreateInstanceCore(System.Guid)at System.Windows.Forms.AxHost.CreateInstance()at System.Windows.Forms.AxHost.GetOcxCreate()at System.Windows.Forms.AxHost.TransitionUpTo(Int32)at System.Windows.Forms.AxHost.CreateHandle()at System.Windows.Forms.Control.CreateControl(Boolean)at System.Windows.Forms.Control.CreateControl(Boolean)at System.Windows.Forms.AxHost.EndInit()at Restaurant.frmMain.InitializeComponent()at Restaurant.frmMain..ctor()
异常信息:System.InvalidOperationException at Restaurant.My.MyProject + MyForms.Create__Instance __ [系统.__佳能, mscorlib,版本= 4.0.0.0,文化=中性, PublicKeyToken = b77a5c561934e089] at Restaurant.frmMain.Main()
以下是我注册文件的方式:
C:\ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ Caspol -q -machine -addgroup 1 -url file:// C:/ xyz / * FullTrust -name“V Drive”
regsvr32 c:\ xyz \ crystl32.ocx
regsvr32 c:\ xyz \ MSCOMCT2.OCX
regsvr32 c:\ xyz \ MSDATGRD.OCX
regsvr32 c:\ xyz \ cpeaut32.dll
regsvr32 c:\ xyz \ msstdfmt.dll
Crystal报告系统上安装的.NET 4框架的运行时引擎(x86和x64)。
答案 0 :(得分:0)
我曾经遇到过这个问题。
I ran Visual Studio as administrator.
Also make sure you know which setting your platform is for the build: AnyCPU, x86, x64
对于你的x86,所以尝试使用AnyCPU!
尝试调试问题 我阅读了微软的一篇文章,该文章说你可以调试发生此异常的地方:
Debug > Exceptions... and use the Find option to locate System.Runtime.InteropServices.COMException. Tick the option to break when it's thrown and then debug your application.