start assembly from "class library" project

M

Marco Zapletal

hi group,

i am facing the following problem:

i have a vs.net (c#) project, which compiles into a class library. now i
wrote a kind of testcase (with a main method()) which i want to execute
(and debug) from vs.net. but i found no possibility how to execute this
testcase in my project...

any help would be appreciated,
thanks in advance,

marco
 
S

Siva M

Hello,

Your testcase project shoud be of type that emits an .exe (console app or
windows app) not a .dll.

hi group,

i am facing the following problem:

i have a vs.net (c#) project, which compiles into a class library. now i
wrote a kind of testcase (with a main method()) which i want to execute
(and debug) from vs.net. but i found no possibility how to execute this
testcase in my project...

any help would be appreciated,
thanks in advance,

marco
 
G

Guest

Hi Marco,
if your class library has the name MyLibrary.dll you need to make a
reference to that DLL from your testing project (right click reference folder
in solution explorer and add it)

Then inside your main class you can create a type that lives in your dll
and debug it. You will need to make sure that you build MyLibrary.dll in
debug mode so that you can step into the code from your main project.

Hope that helps
Mark.
 
M

Marco Zapletal

Siva said:
Hello,

Your testcase project shoud be of type that emits an .exe (console app or
windows app) not a .dll.

first, thanks for your answer. but this means i have to create a second
project (the testcase project that emits an exe), which calls my first
project, or?

regards,

marco
 
S

Siva M

Create the testcase project as win app or console app type, then add a
reference to the class library to be tested and start using the classed
defined in the library.

Siva said:
Hello,

Your testcase project shoud be of type that emits an .exe (console app or
windows app) not a .dll.

first, thanks for your answer. but this means i have to create a second
project (the testcase project that emits an exe), which calls my first
project, or?

regards,

marco
 
R

Reginald Blue

Marco said:
first, thanks for your answer. but this means i have to create a
second project (the testcase project that emits an exe), which calls
my first project, or?

There is another alternative, which is to use a unit test tool like NUnit.
It's crafted to make testing of "class library" projects rather
straightforward.

http://www.nunit.org/

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top