diff --git a/Core/InteropServices/SafeIDispatch.cs b/Core/InteropServices/SafeIDispatch.cs index 9c288cd9..b1c8196f 100644 --- a/Core/InteropServices/SafeIDispatch.cs +++ b/Core/InteropServices/SafeIDispatch.cs @@ -45,7 +45,11 @@ namespace Vanara.InteropServices var result = IntPtr.Zero; try { +#if NETSTANDARD2_0 + result = Marshal.GetComInterfaceForObject(target, typeof(IDispatch)); +#else result = Marshal.GetIDispatchForObject(target); +#endif } finally { @@ -55,5 +59,10 @@ namespace Vanara.InteropServices } return result; } + +#if NETSTANDARD2_0 + [ComImport, Guid("00020400-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + private interface IDispatch { } +#endif } } \ No newline at end of file