Notice: 英文水平实在对不起观众,哈哈哈哈

Error

Could not load file or assembly ‘Vlc.DotNet.Forms, Version=2.1.62.0, Culture=neutral, PublicKeyToken=84529da31f4eb963’ or one of its dependencies.

Detail

tools
1. VLC.DotNet
2. libVLC
3. c# winform



Reason

  1. a wrong platform version library is specified.
  2. for example, use the x64 version of libvlc to build a x86 winform program.
  3. if you meet this problem, two step you should try
    • (1) use code to detect the platform,and chose a right version of libvlc
    • (2) check the build configuration of your projects and solution,make sure you are using the same platform to build all the projects. All use x86 or all use x64.

Demo to Load Right Library

this.testVlcControl.VlcLibDirectoryNeeded +=
new System.EventHandler<Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs>(this.OnVlcControlNeedLibDirectory);
private void OnVlcControlNeedLibDirectory(object sender, VlcLibDirectoryNeededEventArgs e)
        {
            Debug.WriteLine("load lib");
            var currentAssembly = Assembly.GetEntryAssembly();
            var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
            if (currentDirectory == null)
                return;
            if (IntPtr.Size == 4)
                e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"libvlc\win-x86"));
            else
                e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"libvlc\win-x64"));
}





http://xzh.i3geek.com

爱唠叨的老鱼

爱唠叨的老鱼

技术经理,个人站长,创业者

0 条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据