How can I reference a different .NET dll based on debug/release mode?

S

Scott Yost

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 can work
as expected?

Thanks!

Scott Yost
 
S

Silviu Guea [MSFT]

An easy workaround is to not use the reference mechanism and use the
compiler switch /FU and point to the desired dll based on the configuration
in the project settings.

Another one less easier is #using conditioned by the _DEBUG macro in
source files that reference that assembly.
e.g.

#ifdef _DEBUG
#using "mydebugdll.dll"
#else
#using "myreleasedll.dll"
#endif


Silviu Guea, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.


--------------------
| From: "Scott Yost" <[email protected]>
| Subject: How can I reference a different .NET dll based on debug/release
mode?
| Date: Tue, 27 Apr 2004 15:38:40 -0500
| Lines: 13
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.vc
| NNTP-Posting-Host: reno.cs.purdue.edu 128.10.9.108
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.vc:36162
| X-Tomcat-NG: microsoft.public.dotnet.languages.vc
|
| 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 can
work
| as expected?
|
| Thanks!
|
| Scott Yost
|
|
|
 
S

Scott Yost

This does do the trick, except that I now need to manually copy the
appropriate DLL into the directory each time because the references
mechanism no longer takes care of it.
I'm guessing there's no perfect solution to this problem at the moment.
Thank you!
 

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