gpt4 book ai didi

c# - 使用 Microsoft.DirectX.AudioVideoPlayback 播放视频时出错;汇编版本错误

转载 作者:行者123 更新时间:2023-11-30 16:13:23 24 4
gpt4 key购买 nike

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

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

最佳答案

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

设置useLegacyV2RuntimeActivationPolicy在您的应用程序配置文件中作为 true

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

关于c# - 使用 Microsoft.DirectX.AudioVideoPlayback 播放视频时出错;汇编版本错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21799162/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com