Configuration settings

  • Thread starter Thread starter Boris
  • Start date Start date
B

Boris

I encountered a problem, I can't define reference for a specific
configuration.
My project, like any other, has 2 configurations ("Debug" and "Release") In
the "Debug" configuration I use Nunit for testing, so all nunit related code
is under #if NTEST definition. The NTEST declared only in Debug
configuration. However, in order to use NUnit I have to add reference for
nunit.framework.dll. My problem is that I don't want to add this reference
in the release configuration. I don't want to put the dll to the client
machine. Do you know how can I define a reference for a specific
configuration? I think that reflection could help, but I'm not quite sure
how to do it. Please give me an advise if you know.
 
I would recommend that you create a test harness that using NUnit to test
your components. Your components should not need a reference to NUnit. The
test application should create instances of your objects, do the necessary
testing and error trapping.

That's what I do and it works well.
 
You don't have to deploy the NUnit framework to your clients. So long
as none of the NUnit tests don't called then the assembly doesn't need
it. You can explicitly exclude the NUnit assembly in your setup
project (it you use one).

But I don't think you can change this for different configurations.

Adam
 
Boris said:
I encountered a problem, I can't define reference for a specific
configuration.
My project, like any other, has 2 configurations ("Debug" and "Release") In
the "Debug" configuration I use Nunit for testing, so all nunit related code
is under #if NTEST definition. The NTEST declared only in Debug
configuration. However, in order to use NUnit I have to add reference for
nunit.framework.dll. My problem is that I don't want to add this reference
in the release configuration. I don't want to put the dll to the client
machine. Do you know how can I define a reference for a specific
configuration? I think that reflection could help, but I'm not quite sure
how to do it. Please give me an advise if you know.

Rather than include the test fixture code directly in your project, the
recommended way is to create a secondary project and put all the fixtures in
that, and have that project reference nunit.

Then, have the test fixture project only included in the debug build.
 

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

Back
Top