none
Interop.WMPLib problems after updating an project file from VS2008 to VS2010

    Question

  • If I create a new project on VS2010, and add the WMP.dll reference place the WMP control on a blank VB form, build and debug the application it will run just fine.  But if I upgrade a project that already had the WMP.dll reference in it, I cannot debug the application because I gives me this error: 

    ''An error occurred creating the form. See Exception.InnerException for details.  The error is: Could not load file or assembly 'Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.''

    I removed the reference, and added it again and the same problem.  I also removed the Windows Media Player control from the toolbox and added it again.  What step am I missing to properly upgrade this reference?

    Friday, October 22, 2010 5:45 PM

All replies

  • Hello idspence,

    Thanks for your post.

    If you upgrade the project without having the WMP.dll reference in it,  does it run fine?

    Best regards,
    Liliane
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. Thanks
    Monday, October 25, 2010 9:04 AM
  • Hello idspence,

    Thanks for your post.

    If you upgrade the project without having the WMP.dll reference in it,  does it run fine?

    Best regards,
    Liliane
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. Thanks
    Even with the reference in the project the application runs fine.  That is only of the Startup Form does not contain a WMP element.  Only when you try to load a form with the WMP element present does this error occur.
    Saturday, October 30, 2010 9:54 PM
  • I too am facing the same problem. 

    If i remove the wmp control and leave the references then the application runs successfully. any help would be appreciated!!!

    thanks

    heres the exception details

     

    System.InvalidOperationException was unhandled

      Message=An error occurred creating the form. See Exception.InnerException for details.  The error is: Could not load file or assembly 'Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

      Source= Timer

      StackTrace:

           at Timer.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190

           at Timer.My.MyProject.MyForms.get_frmMain()

           at Timer.My.MyApplication.OnCreateMainForm() in C:\Users\Owner\Documents\Visual Studio 2010\Projects\Timer\AudioTimer\My Project\Application.Designer.vb:line 35

           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()

           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)

           at Timer.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81

           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)

           at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)

           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

           at System.Threading.ThreadHelper.ThreadStart()

      InnerException: System.BadImageFormatException

           Message=Could not load file or assembly 'Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

           Source=AxInterop.WMPLib

           FileName=Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

           FusionLog==== Pre-bind state information ===

    LOG: User = Owner-PC\Owner

    LOG: DisplayName = Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

     (Fully-specified)

    LOG: Appbase = file:///C:/Users/Owner/Documents/Visual Studio 2010/Projects/Timer/AudioTimer/bin/Debug/

    LOG: Initial PrivatePath = NULL

    Calling assembly : AxInterop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

    ===

    LOG: This bind starts in default load context.

    LOG: Using application configuration file: C:\Users\Owner\Documents\Visual Studio 2010\Projects\Timer\AudioTimer\bin\Debug\ Timer.vshost.exe.Config

    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.

    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

    LOG: Attempting download of new URL file:///C:/Users/Owner/Documents/Visual Studio 2010/Projects/Timer/AudioTimer/bin/Debug/Interop.WMPLib.DLL.

    ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

     

           StackTrace:

                at AxWMPLib.AxWindowsMediaPlayer.AttachInterfaces()

                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 Timer.frmMain.InitializeComponent() in C:\Users\Owner\Documents\Visual Studio 2010\Projects\Timer\AudioTimer\Form1.Designer.vb:line 2034

                at Timer.frmMain..ctor() in C:\Users\Owner\Documents\Visual Studio 2010\Projects\Timer\AudioTimer\Form1.vb:line 20

           InnerException: 


    Thursday, December 02, 2010 4:44 AM
  • Inranup,

    Will you not hijack other persons threads to tell your problems, simply create your own problem.

    Create your own questions.

    It is for me unclear now if this happens after an update like stated or that you have always had this.

    Hijacking others persons thread is not done in Microsoft forums.

     


    Success
    Cor
    Thursday, December 02, 2010 7:00 AM