3

I am trying to embed video on c# windows form based application, using assembly Microsoft.DirectX.AudioVideoPlayback but getting following 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 am using Visual Studio 2010 .NET version 4.0 Microsoft DirectX SDK is also installed Any link for updated version of library or any alternative?

Code:

using Microsoft.DirectX.AudioVideoPlayback;
namespace MathBook
{
    public partial class Form1 : Form
    {
        Video vd;
        public Form1()
        { InitializeComponent(); }

        private void Form1_Load(object sender, EventArgs e)
        { }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                vd = new Video(@"absolute_file_location.wmv", true);
                vd.Owner = panel1;
                vd.Play();
            }
            catch (Exception ex) { }
        }
    }
}
Yousuf Soomro
  • 169
  • 2
  • 3
  • 10

1 Answers1

3

as error message says you need additional configuration information.

set useLegacyV2RuntimeActivationPolicy as true in your app config file

<startup useLegacyV2RuntimeActivationPolicy="true">
   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
Damith
  • 62,401
  • 13
  • 102
  • 153
  • Thanks you so much Damith: I am trying your solution. – Yousuf Soomro Feb 15 '14 at 15:08
  • 1
    Issue resolved, with your solution. Thank you so much once again for that help. For future reference there were two more problems in my code. 1. I was not catching any exception 2. I was using .flv which is not supported using .wmv file worked perfect. – Yousuf Soomro Feb 15 '14 at 15:21