在c#中寻找一个预处理器指令,用于根据可执行文件是64位还是32位来导入dll:
#if WIN64
[DllImport("ZLIB64.dll", CallingConvention=CallingConvention.Cdecl)]
#else
[DllImport("ZLIB32.dll", CallingConvention=CallingConvention.Cdecl)]
Run Code Online (Sandbox Code Playgroud) 我有一个(anycpu)nuget包"my_shared_library",它必须引用一个nuget包"non_anycpu_dependency",它来自32位或64位(它是数据库访问dll).
我希望32位和64位应用程序都能够使用"my_shared_library".
如何让32位和64位程序都使用"my_shared_library"?
我想我要么必须有2个版本的"my_shared_library",要么可能在运行时根据运行时位选择正确的32位/ 64位nuget包"non_anycpi_dependency".
有人解决了这个问题吗?由于大多数数据库dll都不是anycpu,我认为这是一个常见的问题.
提前致谢,
我正在使用 LibVLCSharp(Vlc nuget 包)设置视频播放器。我已经安装了VideoLAN.LibVLC.Windows 和LibVLCSharp.WPF,到目前为止,在我编译和运行我的代码之前,一切看起来都很好。
我的 VideoPlayer.xaml.cs 文件是这样的:
using LibVLCSharp.Shared;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using MediaPlayer = LibVLCSharp.Shared.MediaPlayer;
namespace kec_wpf.ui
{
public partial class VideoPlayer : Window
{
LibVLC _libVLC;
MediaPlayer _mediaPlayer;
public VideoPlayer()
{
InitializeComponent();
var label = new Label
{
Content = "TEST",
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Bottom,
Foreground = new SolidColorBrush(Colors.Red)
};
test.Children.Add(label);
_libVLC = new LibVLC();
_mediaPlayer = new MediaPlayer(_libVLC);
// we need the VideoView to be fully loaded before …Run Code Online (Sandbox Code Playgroud)