?
Solved

Creating a DLL in CSharp in .Net

Posted on 2011-10-20
3
Medium Priority
?
342 Views
Last Modified: 2013-12-16
Hi,

I am trying to learn about create DLL's in CSharp. I came across the following website page http://www.geeksengine.com/article/create-dll.html and was trying to replicate the example. I have named my project "LibTest".

In my folder C:\Users\user\Documents\Visual Studio 2008\Projects\Mine\LibTest\LibTest\bin\Debug I have two files, LibTest.dll and LibTest.pdb.

The issue I have is that Excel will not let me add the refence when I select the above dll file, the error message says "Cannot load reference".

I have ticked both "Make Assembly  COM-Visable" & "Register for COM Interop".

I have no idea what, how or if I need to use RegAsm.exe?

As always thanks for any help,

Mark
0
Comment
Question by:mcs26
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
sachinpatil10d earned 2000 total points
ID: 36998777
Yes you will have to use RegAsm.exe

compile your dot net dll

start>>run
%comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86

Open in new window

visual studio command prompt will appear

use the RegAsm.exe
regasm /tlb:LibTest.tlb "C:\Users\user\Documents\Visual Studio 2008\Projects\Mine\LibTest\LibTest\bin\Debug\LibTest.dll"

Open in new window

This will create LibTest.tlb add the reference of this file.
0
 

Author Comment

by:mcs26
ID: 36998982
Hi Sachin,

Thanks for the reply. I will try your suggestion when I get home this evening as sadly my work place does not have microsoft visual studio's. I am using Visual Studio 2008 so guessing the path you supplied above will be the same bar the 2010 part?

What excatly does the RegAsm.exe do then as I thought by ticking the ""Register for COM interop" that excel should be able to reference the dll file.

Also where would I find the codebase file folder highlighted in the example?

Many thanks
0
 

Author Comment

by:mcs26
ID: 37002664
Hi just trying the commands. The error message I get is that I must have admistrative credentials. This is my laptop so how do I do this via the command prompt?

Thanks,
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

578 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