473,608 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Removing a reference from Release build?

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.
Nov 22 '05 #1
3 2642
"Petri J. Riipinen" <petri.riipinen @koti.(NOSPAM). soon.fi> wrote

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.


Hi Petri, I am doing the same as you do, and AFAIK assemblies are only
referenced when they are _used_ by your project build. VS still copies them
to the target directory, but check your project output's manifest to see the
assemblies actually referenced!

Jens.

--
http://ManagedXLL.net/ | http://jens-thiel.de/ | http://QuantLib.net/
Replace MSDN with my first name when replying to my email address!

Nov 22 '05 #2
Jens Thiel wrote:
"Petri J. Riipinen" <petri.riipinen @koti.(NOSPAM). soon.fi> wrote

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.


Hi Petri, I am doing the same as you do, and AFAIK assemblies are only
referenced when they are _used_ by your project build. VS still
copies them to the target directory, but check your project output's
manifest to see the assemblies actually referenced!


The copying is not the problem in the release deployment as I have one
Setup-project which is used to distribute the assemblies to several other
programmers the use the assemblies. Of course the Setup-project suggests
adding the nunit.framework .dll to the project as there is an obvious
dependency inside the VS.NET-project references but I can always exclude the
nunit.framework .dll from the setup project.

Have you verified that although you reference the (nunit.framewor k?)
assembly in VS.NET and leave out the unit testing code from the
Release-build, there is no need to include the nunit.framework .dll with the
other assemblies?

Ok, will check the manifest as you suggest.

- Petri
Nov 22 '05 #3
> Have you verified that although you reference the (nunit.framewor k?)
assembly in VS.NET and leave out the unit testing code from the
Release-build, there is no need to include the nunit.framework .dll with the other assemblies?


I have verified it with another assembly, that is only used for a special
edition build, not using any types from that assembly (using #if...). No
problems with that (using VS.NET 2003 and v1.1 if that matters somehow).

Try to remove your reference and see if your project still compiles. Maybe
you have missed to "#if" something?

Jens.

--
http://ManagedXLL.net/ | http://jens-thiel.de/ | http://QuantLib.net/
Replace MSDN with my first name when replying to my email address!
Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
319
by: Petri J. Riipinen | last post by:
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...
2
3183
by: VM | last post by:
When I'm adding a reference to another project that is built as one of the Projects in the Solution, should I add the dll in Debug or the one in Release? I usually also do a batch build of everything (Release and Debug) so I don't know if that would be a factor. The reason I'm asking is that one of the projects that I'm adding to another project as reference is not recognizing any of the new changes (new methods) that I've made. I have to...
2
3946
by: Scott Yost | last post by:
I reference a .NET DLL to import some of my custom types. I can build that DLL in debug or release mode, but I usually keep the debug one built so I can debug it. When I want to link to the release version of the DLL, I find that I have to remove the reference from the project and point VS. NET to the release version of the DLL. Is there some way to do this automatically, like it usually done in the past, so that the release/debug switch...
3
2882
by: Steve Franks | last post by:
I'm using Visual Studio 2005 RC and cannot figure out how to produce a "release" build. Am I doing something wrong? I'm wondering if perhaps MS locked out the ability to produce a release build when using the RC since it does not have a go-live license? Or maybe I'm just doing something wrong. I do not want to go live with a release build. Rather I just want to test locally to see if there is a performance difference and also to...
11
1909
by: Just Me | last post by:
I have a solution containing many usercontrol projects. When I wish to reference a usercontrol in another project I can select either the project or the assembly. Does it make a difference which one I select? Thanks
7
13793
by: Oldman | last post by:
How do you conditionally reference an assembly based off of the build configuration? Imagine a scenario where I want to have an Sql Release Server build and an Oracle Release Build and the only difference between them is a reference to a different assembly. Is it possible to do this in VS2005?
5
9126
by: Richard J Foster | last post by:
Hi there, I have a pair of C# projects in VS2003. The first project, a dll, is referenced in the second via a project reference. The assemblies in question are delay-signed during a "production" build process, but not as part of a normal development build. I have noticed that while the correctly signed assembly is present in the designated output folder for the project (e.g. bin/Release), an
1
2984
by: kurt sune | last post by:
I am having trouble publishing a website for RELEASE. 1. web.config: <compilation defaultLanguage="vb" debug="false"> 2. in Configuration manager I set the configuration to Release for the website 3. in Configuration manager I set the Active solution configuration to Release
11
3240
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When my object is destroyed, I want my object to un-register this event. If I don't then the object would never be destroyed until the object I passed in the constructor is destroyed. I have implemented a Dispose(), Dispose(bool), and ~Finalize...
3
3435
by: Arodicus | last post by:
This is bugging me: how do I reference the topmost node (HTML) within a document? I'd like to set a class on it, which specifies various browser/os/versions so that several browser/os/version-specific css bugs may be addressed without coding. eg: <HTML class="_IE _IE7 _Win _IE7Win"> The closest I've come is document.body.parentNode (line 22, below), but this of course requires that my script be executed from within body... I'd prefer to...
0
8000
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6815
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1328
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.