Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2007-11-28
7
Medium Priority
?
825 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

885 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