Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi;
I don't know where the problem is occurring, but I'm trying to use the DirectX SDK to play an MP3 file. My code is as follows:
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX;
using Microsoft.DirectX.AudioVideoPlayback;

namespace Media_Player
{
    class Program
    {
        static void Main(string[] args)
        {
            Audio a = new Audio("Ozzy.mp3");
            a.Play();
            Console.ReadKey();
        }
    }
}

I get errors at runtime. First of all, I'm using Visual Studio 2010, and when I go to add the reference to the DirectX dlls, it doesn't show up in the .NET references (I add them by going to C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\).

I get a FileLoadException error: "Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."

I'm assuming this is because I'm running an old version of DirectX? But I've also tried running the same code in Visual Studio 2008. The DirectX dlls show up in the .NET references in 2008, and I can add them, but I get a BadImageFormatException saying "is not a alid Win32 application. (Exception from HRESULT: 0x800700C1)". I have been going crazy, looking everywhere to try and find a solution. I've tried running on different computers and everything,

I just don't know what's going wrong. If anyone can help, I'd be very grateful.

Thanks in advance!
Posted
Updated 7-May-11 8:04am
v2
Comments
[no name] 25-May-11 17:49pm    
Two questions:
1) do you have Microsoft .NET Framework v1.1.4322 installed?
2) what version of OS (32/64 bit) are you running?
- in case of 64 bit: change the platform to x86
- make sure you have 32bit codecs installed

Perhaps this will help or give you some ideas how to solve your problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900