Search code examples
c#.netsharpdevelop

Remove NUnit reference for Release build


I have a project with many NUnit tests. I am happy for these tests to be included in the Debug configuration build but I would like to remove the dependency on nunit.framework for the Release configuration. Is there a way of excluding the NUnit reference and the nunit test objects for a specific (Release) configuration? I am using Sharp Develop but I am curious how you would approach this problem with Visual Studio as well.

Any clues?


Solution

  • It sounds like you've got your tests in the same project as your release code. That's not a great idea - split the code into two projects, one with the tests and one with the production code. Only the test project will need to refer to NUnit.

    That also means that none of the tests will ship with the release code, and it's easier to browse just the production code or just the test code.