我正在尝试将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,将现有窗体添加到项目中等,但都没有效果。
我有什么地方做错了吗?
发布于 2016-11-15 08:46:14
我不确定你是否还在寻找解决方案,但也许这会对其他人有所帮助。我只是在尝试嵌入不同的COM对象时遇到了同样的问题。
在用头撞墙几个小时后,我意识到在项目Properties -> Build -> Platform Target中被设置为x64 (因为几个月前我正在玩一些东西),并且许多这些旧的COM程序集都是针对32位系统的。无论如何,将我的平台目标切换到“任何CPU”解决了这个问题。
耐克
发布于 2018-08-20 03:00:03
我通过从引用中删除'AxWMPLib',"WMPLib“引用解决了这个问题。然后。再次在窗体上添加媒体播放器。
发布于 2020-07-30 06:23:29
对于像我这样的Noobs,从引用中删除'AxWMPLib',"WMPLib“引用,也从ToolBox中删除"Windows Media Player”,然后关闭项目(Visual Studio),然后再次打开项目,然后转到属性->编译->目标CPU = x86和Platform = x86,然后通过ToolBox添加Windows Media Player,然后重建项目。通过拖放使用工具箱添加媒体播放器控件...Problem Solve ^_^
https://stackoverflow.com/questions/36275096
复制相似问题