C# Windows 媒体播放器 AxHost 错误 : Failed to create compopnent 'AxHost'

标签 c# windows media-player media axhost

我正在尝试将 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,它会工作得很好。

我尝试了一些在线解决方案,例如在打开新项目(With Windows Media Player)时添加 Windows Media Player,将现有表单添加到项目等,但无济于事。

有没有我做错了什么?

最佳答案

不确定您是否仍在为此寻找解决方案,但也许这会对其他人有所帮助。我在尝试嵌入不同的 COM 对象时遇到了同样的问题。

在用头撞墙几个小时后,我意识到在项目 Properties -> Build -> Platform Target 中设置为 x64(因为几个月前我正在玩一些东西),而且很多这些旧的 COM 程序集针对 32 位系统。无论如何,将我的平台目标切换为“任何 CPU”解决了这个问题。

尼克

关于C# Windows 媒体播放器 AxHost 错误 : Failed to create compopnent 'AxHost' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36275096/

相关文章:

javascript - 使用 Bitmovin 播放器寻找 VOD

c# - Linq 中使用哪些方法强制从数据库中检索数据

c# - 对 Winform 控件的线程安全调用

Windows 服务恢复未重新启动服务

android - MediaPlayer、原始资源、停止和启动问题

安卓媒体播放器 : Download to File and Stream From File

c# - 与 SharePoint 列表版本控制和 C# 交互

c# - 从特定的 listindex 到 c# 中的列表末尾对 List<byte[]> 进行排序

c++ - 如何在 Windows x64 C++ 应用程序中捕获堆栈溢出

c# - 64 位 .Net 应用程序中的内存限制?