diff --git a/src/PDFtoImage/Internals/NativeMethods.cs b/src/PDFtoImage/Internals/NativeMethods.cs index 5e191e53..7e35d21e 100644 --- a/src/PDFtoImage/Internals/NativeMethods.cs +++ b/src/PDFtoImage/Internals/NativeMethods.cs @@ -278,7 +278,8 @@ private static int FPDF_GetBlock(IntPtr param, uint position, IntPtr buffer, uin private static partial class Imports { -#if NET7_0_OR_GREATER && !WASM + // LibraryImport is not supported by Blazor WebAssembly +#if NET7_0_OR_GREATER && FALSE [LibraryImport("pdfium")] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void FPDF_InitLibrary(); @@ -383,6 +384,9 @@ private static partial class Imports [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial IntPtr FPDFDOC_InitFormFillEnvironment(IntPtr document, FPDF_FORMFILLINFO formInfo); #else +#if NET7_0_OR_GREATER +#pragma warning disable SYSLIB1054 +#endif [DllImport("pdfium", CallingConvention = CallingConvention.Cdecl)] public static extern void FPDF_InitLibrary(); @@ -456,13 +460,16 @@ private static partial class Imports public static extern void FPDF_RemoveFormFieldHighlight(IntPtr form); [DllImport("pdfium", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] -#if NET6_0 +#if NET6_0_OR_GREATER [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA2101:Specify marshalling for P/Invoke string arguments")] #endif public static extern IntPtr FPDF_LoadCustomDocument(FPDF_FILEACCESS access, string? password); [DllImport("pdfium", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr FPDFDOC_InitFormFillEnvironment(IntPtr document, FPDF_FORMFILLINFO formInfo); +#if NET7_0_OR_GREATER +#pragma warning restore SYSLIB1054 +#endif #endif } diff --git a/src/WebConverter/WebConverter.csproj b/src/WebConverter/WebConverter.csproj index 728fcfad..0d017a30 100644 --- a/src/WebConverter/WebConverter.csproj +++ b/src/WebConverter/WebConverter.csproj @@ -22,7 +22,6 @@ strict nullable CA1416 - $(DefineConstants);WASM