SgDotNet
Singapore Professional .NET User Group -For Cool Developers

C# DLL's

Latest post 01-31-2008 7:44 PM by Sur3ndEr. 1 replies.
  • 01-25-2008 3:53 PM

    • xarzu
    • Top 150 Contributor
    • Joined on 10-03-2007
    • Posts 12

    C# DLL's

    I thought that my problem was how I was declaring a manifest file.
    But now I think I can safely rule this out.

    I think the probem lies in the way I am loading the DLL/COM object
    that the manifest file references.

    The program runs -- sort of.  After I embed the manifest file into
    the executable.  I just cannot step through the code in debug mode.

    So I put the manifest file into the list of files that the IDE had
    to reference.  And then I noticed a big change.  Then the executable
    that I produced had an error message (that I could ignore and continue
    running the program, if I choose to) that said the probem was
    with the way I was loading the COM object.

    How do I load a DLL into a GUI front-end written in C#.  Where
    should I look for possible problems?

    There is something else that interests me.  There is a file that appears
    in some of the output directories called <project name>.vshost.exe.
    How is this used in the project and connected with external COM objects?

    Also, how do I use WinDbg?

    I did some study on Click Once.  Tell me if I am getting this right.
    Basically Click Once is a way of making software that a user can easily
    install (by clicking once) and a developer can make the software such
    that it is easy to publish versions of his work either locally or on the internet.

    I made a list of links and I watched some videos that Microsoft put together.

    I do not think my issue has much to do with Click One, but, on the other hand,
    I am new to this.

    Bacically, I am able to load the COM object in a different application.
    So I already know that the object is loaded.  I also know that it is the
    debug version of the object.

    So I think I can rule out Click One as a source for a solution.

  • 01-31-2008 7:44 PM In reply to

    • Sur3ndEr
    • Top 500 Contributor
    • Joined on 12-11-2007
    • Singapore
    • Posts 4

    Re: C# DLL's

    Your question is not very clear. But I can try to explain some for you.

    1.     Are you talking about Unmanaged DLLs?. I assume you are using an unmanaged DLL here. An unmanaged DLL can be of two types one is a normal DLL (Win32 or MFC DLL) and the other one is a COM DLL. We will be using different ways to call these DLLs in a C# application (It can be a GUI app or Console app or a Web App). When it comes to a normal DLL we have to use P/Invoke to call the methods in the DLL and this is done by using the DllImportAttribut in .Net. If your DLL is a COM DLL you have to create a Runtime Callable Wrapper (RTW) and refer it from your C# application.

    2.     When you add a reference to a COM DLL using Visual studio the RTW will be created automatically for you.

    3.     The .vshost.exe file is Created by visual studio its actually for VisualStudio host file you don’t have to worry about that file J.

    4.     When you add an item to the project you can set that items build action from the properties window so check the build action of your manifest file.

    5.     When you talk about manifest file are you talking about the ClickOnce manifest file or the application manifest file?

    I have worked a lot on P/Invoke so if you can clarify this I can help you one this.

    Suren.

Page 1 of 1 (2 items) | RSS
Copyright SgDotNet 2004-2008
Powered by Community Server (Commercial Edition), by Telligent Systems