3

Windows Media Player オブジェクトを Windows フォームに追加しようとしていますが、次のエラーが表示されます。

Failed to create compopnent 'AxHost'. The error message follows:
'System.Reflection.ReflectionTypeLoadException: Unable to load
one or more of the requested types. Retrieve the LoaderExceptions
property for more information.
  at
System.Windows.Forms.Design.DocumentDesigner.AxToolboxItem.
CreateComponentsCore(IDesignerHost host)
  at
System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost 
host, IDictionary defaultValues)
  at
System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost
host, IDictionary defaultValues)
  at
System.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem
tool, Control parent, int32 x, int32 width, int32
height, Boolean hasLocation, Boolean hasSize,
ToolboxSnapDragDropEventArgs e)'

ただし、新しいプロジェクトを作成して Windows Media Player を追加すると、まったく問題なく動作します。

新しいプロジェクト(Windows Media Playerを使用)が開いている間にWindows Media Playerを追加したり、既存のフォームをプロジェクトに追加したりするなど、オンラインでいくつかのソリューションを試しましたが、役に立ちませんでした。

私が間違ったことをしたことはありますか?

4

3 に答える 3

6

これに対する解決策をまだ探しているかどうかはわかりませんが、おそらくこれは他の誰かを助けるでしょう. 別のCOMオブジェクトを埋め込もうとすると、同じ問題が発生しました。

数時間壁に頭をぶつけた後、プロジェクトの [プロパティ] -> [ビルド] -> [プラットフォーム ターゲット] が x64 に設定されていることに気付きました (数か月前に何かで遊んでいたため)。アセンブリは 32​​ ビット システムを対象としています。とにかく、プラットフォームターゲットを「任意のCPU」に切り替えると問題が解決しました。

ニック

于 2016-11-15T00:46:13.707 に答える