Hi everyone,
I have tried everything, read examples and etc, but I can't expose my DLL to COM Interop.
The project has a strong key added and checked the option Register for COM Interop but when I try to call my DLL in other apps says that can't find the entry point named ExecInClientDLL.Could someone show me where I'm wrong?
Best regards,Renan PaivaFollowing my code:
Class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace dllProtheus
{
[Guid("5B38DC58-E9E4-11E4-B496-C4621D5D46B0")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IExecInClientDLL
{
[DispId(1)]
int ExecInClientDLL(int id, string parametro, string buffer, int bufferSize);
}
[Guid("69C68270-E9E4-11E4-B493-CB621D5D46B0")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(IExecInClientDLL))]
[ProgId("dllProtheus.TesteDLL")]
public class TesteDLL : IExecInClientDLL
{
public TesteDLL() { }
public int ExecInClientDLL(int id, string parametro, string buffer, int bufferSize)
{
buffer = "retorno da dll " + parametro;
return 200;
}
}
}
My assembly:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("dllProtheus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("dllProtheus")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ccc6e7d6-c921-452f-9759-cc1bac0113b1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]