【问题标题】:Error playing video using Microsoft.DirectX.AudioVideoPlayback; assembly version error使用 Microsoft.DirectX.AudioVideoPlayback 播放视频时出错;汇编版本错误
【发布时间】:2014-02-15 14:56:34
【问题描述】:

我正在尝试在基于 c# windows 表单的应用程序中嵌入视频,使用程序集 Microsoft.DirectX.AudioVideoPlayback 但出现以下错误

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.

我正在使用 Visual Studio 2010 .NET 4.0 版 还安装了 Microsoft DirectX SDK 库的更新版本或任何替代版本的任何链接?

代码:

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) { }
        }
    }
}

【问题讨论】:

    标签: c# .net visual-studio-2010 directx audiovideoplayback


    【解决方案1】:

    因为错误消息说您需要额外的配置信息。

    在您的应用配置文件中将useLegacyV2RuntimeActivationPolicy 设置为true

    <startup useLegacyV2RuntimeActivationPolicy="true">
       <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
    

    【讨论】:

    • 非常感谢 Damith:我正在尝试您的解决方案。
    • 问题已解决,您的解决方案。再次感谢您的帮助。为了将来参考,我的代码中还有两个问题。 1. 我没有发现任何异常 2. 我正在使用 .flv 不支持使用 .wmv 文件完美运行。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-20
    • 1970-01-01
    • 2014-03-30
    • 1970-01-01
    相关资源
    最近更新 更多