Solved

How to create a DLL using Visual Studio C# that registers with regsvr32 NOT regasm ?

Posted on 2007-11-28
7
749 Views
Last Modified: 2013-11-26
Hi,
I'm trying to create a DLL to use in an application that is not .net.  (Actually Microsoft Dynamics Nav not that it should matter)

Anyways I created a class library and compiled to dll.  However I can only register it using regasm /tlb option.  This in return always gives me the Entry Point not found in the other application.  So my feeling is that I need to build some interface or something on top ?
public class TestDLL
    {
        private string myString = "EMPTY";
 
        public Tenging()
        {
        }
 
        public string MyProperty
        {
            get
            {
                return myString;
            }
            set
            {
                myString = MyProperty;
            }
        }
    }

Open in new window

0
Comment
Question by:Pall Palsson
  • 3
  • 2
7 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 20370480
you don't have the choice to use regasm.
0
 

Author Comment

by:Pall Palsson
ID: 20372707
First off the code snipped is wrong in the way that the constructor should of course be of TestDLL().

Anyways I don't understand what you mean by that !  Right now my only choice seems to be regasm but the result is not what I expect as when I try and use the DLL I always get the DLL Entry Point not found error.

Upon further reading I'm starting to think that I need to write some sort of COM wrapper or Interop.

Does anyone have a link to a good sample ?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 20373052
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:Pall Palsson
ID: 20378594
Perhaps I'm not explaining the problem correctly.

What I want to accomplish is making a "old school" COM DLL using c#.net.  I can make a DLL that publishes its interface to .Net but not Win32.

I tried making a simple Class library using the ComClass in VB.net but that gave me the same result.  The Inteface (methods, attributes etc) is not published so when I open the DLL in a program like DLL Export Viewer it comes up empty.
0
 

Author Comment

by:Pall Palsson
ID: 20440572
Got it to work

Application->Assembly Information->Check Make Assembly COM-Visible
Build->Settings->Check Register for COM Interop
Signing->Check Sign the Assembly
using System.Runtime.InteropServices;
 
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ITestDLL
{
    [DispId(1)]
    string MyProperty {get; set; }
}
 
[ClassInterface(ClassInterfaceType.None)]
[ProgId("<Namespace>.TestDLL")]
public class TestDLL : ITestDLL
{
    etc.

Open in new window

0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 20615325
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Receiving a string from a WebService Push 21 51
Entity Framework 7 43
Need a starter for ETL protocol? 4 57
VB.NET 2008 Publish Error 2 27
IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question