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
- a wrong platform version library is specified.
- for example, use the x64 version of libvlc to build a x86 winform program.
- 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 条评论