我正在尝试将视频嵌入到基于c#windows form的应用程序中,使用程序集 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) { }
}
}
}
答案 0 :(得分:3)
正如错误消息所示,您需要其他配置信息。
在您的应用配置文件中将useLegacyV2RuntimeActivationPolicy
设置为true
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>