P
Petri J. Riipinen
Hi,
I'm writing a largish (>60 projects) solution with VS.NET 2003 using VB.NET
as my implementation language. I'm using NUnit and NUnit VS.NET-addin to
implement unit tests for my code.
Currently I have a single UnitTests-project that contains unit tests for all
other projects. This way I can embed all unit testing into a single assembly
which I can use during the development but exclude from a setup that I
create from other projects, thus excluding the unit testing code from the
release-version. This works fine otherwise except it is not very logically
nice to have all the unit testing code inside one project.
BUT: What I would like to do is to embed the unit testing code for each
project inside projects themselves. I would have in each project two folders
"Source", and "UnitTests" that would conveniently separate the unit testing
code from the application code and still retain them in the same project as
they are related.
I think that I can exclude all the unit testing code with a compiler
directive so that none of the unit testing code will be included into the
release-build. That is fine.
But how about the nunit.framework-assembly that I must reference from the
projects? Now it is not a problem as the assembly is referenced only from
the specific UnitTests-project. But if I distribute the unit testing code
into separate projects, each project needs to reference nunit.framework.dll
and I would want leave that reference out from the release build because I
know from the compiler directive that there is no code that actually uses
the nunit-classes in the release build.
So, basically my need would be satisfied if I could say to VS.NET that a
particular reference is to be included only in Debug-build. Or if I could
make the reference conditional, say, depending on a DEBUG-definition
constant.
So, do I have any chance of doing this?
- Petri
PS. I'm not sure if .NET CLR causes problems if a reference DLL is not
present even if I don't refer to it, but I suspect it might.
I'm writing a largish (>60 projects) solution with VS.NET 2003 using VB.NET
as my implementation language. I'm using NUnit and NUnit VS.NET-addin to
implement unit tests for my code.
Currently I have a single UnitTests-project that contains unit tests for all
other projects. This way I can embed all unit testing into a single assembly
which I can use during the development but exclude from a setup that I
create from other projects, thus excluding the unit testing code from the
release-version. This works fine otherwise except it is not very logically
nice to have all the unit testing code inside one project.
BUT: What I would like to do is to embed the unit testing code for each
project inside projects themselves. I would have in each project two folders
"Source", and "UnitTests" that would conveniently separate the unit testing
code from the application code and still retain them in the same project as
they are related.
I think that I can exclude all the unit testing code with a compiler
directive so that none of the unit testing code will be included into the
release-build. That is fine.
But how about the nunit.framework-assembly that I must reference from the
projects? Now it is not a problem as the assembly is referenced only from
the specific UnitTests-project. But if I distribute the unit testing code
into separate projects, each project needs to reference nunit.framework.dll
and I would want leave that reference out from the release build because I
know from the compiler directive that there is no code that actually uses
the nunit-classes in the release build.
So, basically my need would be satisfied if I could say to VS.NET that a
particular reference is to be included only in Debug-build. Or if I could
make the reference conditional, say, depending on a DEBUG-definition
constant.
So, do I have any chance of doing this?
- Petri
PS. I'm not sure if .NET CLR causes problems if a reference DLL is not
present even if I don't refer to it, but I suspect it might.