- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
-
- namespace MyProject.Developer
- {
- [ComImport]
- [TypeLibType(4160)]
- [Guid("AAEDE8D0-E600-11D1-97E8-006008103DE4")]
- public interface IPDTool
- {
- [MethodImpl(MethodImplOptions.InternalCall)]
- [DispId(1)]
- void CheckTool([In] int lFeature, out int plVersion, out int plType);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- [DispId(2)]
- bool GetConfigBool([In] [MarshalAs(UnmanagedType.BStr)] string bstrKey, [In] bool bDefault);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- [DispId(3)]
- int GetConfigLong([In] [MarshalAs(UnmanagedType.BStr)] string bstrKey, [In] int lDefault);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- [DispId(4)]
- [return: MarshalAs(UnmanagedType.BStr)]
- string GetConfigString([In] [MarshalAs(UnmanagedType.BStr)] string bstrKey, [In] [MarshalAs(UnmanagedType.BStr)] string bstrDefault);
- }
- }
-
-
-
- using System.Runtime.InteropServices;
-
- namespace MyProject.Developer
- {
- [ComImport]
- [CoClass(typeof(MyNETToolClass))]
- [Guid("AAEDE8D0-E600-11D1-97E8-006008103DE4")]
- public interface MyNETTool : IPDTool
- {
- }
- }
-
-
-
- using System;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
-
- namespace MyProject.Developer
- {
- [ClassInterface((short)0)]
- [Guid("11429564-E600-4903-82A5-D45AB82B860B")]
- [TypeLibType(2)]
- public class MyNETToolClass : MyNETTool, IPDTool
- {
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
- public extern MyNETToolClass();
-
- [DispId(1)]
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
- public virtual extern void CheckTool([In] int lFeature, out int plVersion, out int plType);
-
- [DispId(2)]
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
- public virtual extern bool GetConfigBool([In] string bstrKey, [In] bool bDefault);
-
- [DispId(3)]
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
- public virtual extern int GetConfigLong([In] string bstrKey, [In] int lDefault);
-
- [DispId(4)]
- [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
- public virtual extern string GetConfigString([In] string bstrKey, [In] string bstrDefault);
- }
- }
I have some assemblies in a solution one of which uses a ComImport. I would like to eliminate the ComImport as all the projects are in the same solution and simply reference but I keep getting errors that relate to the ComImport. Mainly when I reference the .dll it still thinks it is not referenced. How can I convert this to a standard interface that I can reference?