开发者

Why is Interop.WMPLib unable to load assembly in Release mode, but works in Debug mode?

I have added the Windows Media Player com control into my toolbox and then used the control successfully on a Form in Debug mode.

However, when I try running the application in Release mode it errors with...

Could not load file or assembly 'Interop.WMPLib, ... or one of its dependecies. An attempt was made to load a program with an incorrect format.

Through some tracing I've established that the error occurs not when creating the control but on the EndInit me开发者_运维问答thod.

Public Sub New

    InitializeComponent() 

    wmp = New AxWMPLib.AxWindowsMediaPlayer()
    wmp.BeginInit()
    wmp.Enabled = True
    wmp.Name = "wmp"
    wmp.OcxState = CType(resources.GetObject("wmp.OcxState"), AxHost.State)
    Me.Controls.Add(wmp)
    Me.Controls.SetChildIndex(wmp, 0)
    wmp.Dock = System.Windows.Forms.DockStyle.Fill
    wmp.EndInit()   ' <<< errors here !

End Sub

What am I missing?


You changed the Platform target setting in the Debug configuration. Possibly weeks ago, maybe even in a previous version of Visual Studio. But didn't change it in the Release configuration. It is one of the settings that is configuration specific.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜