3

AxDrawingControlアプリケーションでdll AxInterop.Microsoft.Office.Interop.VisOcx.dll(v4.0.30319)を使用すると、以下の例外が発生します。

System.Runtime.InteropServices.COMException occurred
HResult=-2147221164
Message=Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Source=System.Windows.Forms
ErrorCode=-2147221164

The stackTrace:

   at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
   at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
   at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstance()
   at System.Windows.Forms.AxHost.GetOcxCreate()
   at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
   at System.Windows.Forms.AxHost.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.AxHost.EndInit()
   at TestVisOcxAxDrawing.VisioTestForm.InitializeComponent() in C:\ TestVisio\TestVisOcxAxDrawing\VisioTestForm.Designer.cs:line 55
  InnerException:
  • アプリケーションは、構成マネージャーで「任意の CPU」として構成されています -> 「アクティブ ソリューション プラットフォーム」</li>
  • Windows8 64 ビット OS で 64 ビット アプリケーションとして実行すると、アプリは上記のエラーをスローします。
  • Visio のインストールは、Professional 2010、x86 バージョンです。

    これまでの私の観察は次のとおりです。

    1. visio x64 バージョンがインストールされている場合、visio 描画コントロールは正常に読み込まれます。
    2. 「アクティブ ソリューション プラットフォーム」を x86 版に変更しても問題なく動作します。

残念ながら、私の場合、上記の回避策はどちらも不可能です。これは、クリック ワンス アプリケーションであり、Visio の任意のバージョンがインストールされた任意のバージョンの Windows でクライアントが実行されている可能性があるためです。

質問:

  1. アプリケーションを「任意の CPU」として構成しても、visio 32 ビット バージョンと 64 ビット バージョンの両方をサポートできますか?
  2. そのようなシナリオを処理するための代替手段/ベスト プラクティスはありますか?

    • 例: アプリのバージョン 32 と 64 を別々にリリースしますか?
    • または、Visio dll の 64 ビット バージョンと 32 ビット バージョンの両方をアプリと共に出荷し、エラーが発生したときにそれらを切り替えることは可能ですか?

再作成の手順

  1. 64 ビット Windows OS のマシンの VS2010 で新しい Windows フォーム プロジェクトを作成します。
  2. Any CPU構成マネージャー -> のようにプロジェクトを構成しActive Solution Platformます。
  3. ツールボックスを右クリックし、クリックChoose Items->COM Componentsタブに移動 -> チェックMicrosoft Office Visio 14.0 Drawing Control
  4. Visio 描画コントロールがツールボックスに表示されます。
  5. Microsoft Office Visio 14.0 Drawing Controlコントロールをフォームにドラッグし、を押しF5ます。
  6. Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))エラーがスローされます。

ありがとう、よろしく、プラヴィーン

4

0 に答える 0