平台目标:anycpu 下是正常播放
如果是 x86  则报错 %1不是有效的 win32应用程序 
 private void vlcControl1_VlcLibDirectoryNeeded(object sender, VlcLibDirectoryNeededEventArgs e) {
            var currentAssembly = Assembly.GetEntryAssembly();
            var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
            if (currentDirectory == null)
                return;
            if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
                e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"lib\x86\"));
            else
                e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"lib\x64\"));            if (!e.VlcLibDirectory.Exists) {
                var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
                folderBrowserDialog.Description = "Select Vlc libraries folder.";
                folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop;
                folderBrowserDialog.ShowNewFolderButton = true;
                if (folderBrowserDialog.ShowDialog() == DialogResult.OK) {
                    e.VlcLibDirectory = new DirectoryInfo(folderBrowserDialog.SelectedPath);
                }
            } 
        }
x86   x64都有正常对应的目录  
大神们帮帮忙  ,一共只有50分 全给了 

解决方案 »

  1.   

    就算你设为x86
    ProcessorArchitecture也未必会返回ProcessorArchitecture.X86
    这样将会使用x64的文件夹,从而报错
    你可以使用Environment.Is64BitProcess试试
      

  2.   

      if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
                    e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"lib\x86\"));已经进到这一步了,的确是86的  就是会出错。我怀疑 是不是  86的库有问题    还是哪里要设置什么 搞了2天了 没搞明白