Using different references based on "build"

B

Bruce

I am using VB in Vs2005. Am I missing something or does VB not have the
concept of "builds" (release/debug) like in VC? I wrote an assembly
and I would like to have a debug version of the DLL and a release
version of the DLL. I would like to create some sample code that
demonstrates my assembly in VB and would like to have two builds, one
using my debug version and the other using the release version of the
assembly.

How can I do this? I can't see how in VB.

P.S. I am currently using the Express version so perhaps that explains
why I am not seeing this?
 
B

Bruce W. Darby

Bruce,

If you right-click on your project in the Solution Explorer and select Open,
it will bring you to the properties dialog. Compile or Debug should do ya.
:) Hope this helps.

Bruce
 
B

Bruce

Bruce said:
Bruce,

If you right-click on your project in the Solution Explorer and select Open,
it will bring you to the properties dialog. Compile or Debug should do ya.
:) Hope this helps.

Thanks Bruce. I know how to bring up the properties box. I can see
the debug tab. But I don't think that is what I want.

What I want to do is use one external referenced assembly for debug and
another for release. I just see one set of references period.

Bruce
 
S

Stephany Young

Now I can see what you are attempting.

Assuming that your 'external assembly' was also developed in VS 2005, then
simply add your 'external project' to your current solution, change the
reference to it to be 'project' rather than 'file', then, when you compile
your current project in 'debug', it will use the 'debug' version of your
'external assembly' and when you compile your current project in 'release'
it will use the 'release' version of your 'external assembly'.


and make your current project If you add the project for your
 
B

Bruce

Stephany said:
Now I can see what you are attempting.

Assuming that your 'external assembly' was also developed in VS 2005, then
simply add your 'external project' to your current solution, change the
reference to it to be 'project' rather than 'file', then, when you compile
your current project in 'debug', it will use the 'debug' version of your
'external assembly' and when you compile your current project in 'release'
it will use the 'release' version of your 'external assembly'.


But the external assembly is written in C++, so there are two different
file names for the assembly MyAssemblyD.Dll for debug and MyAssembly.DLL
for release.

Plus remember that these are sample VB projects so, once if I
distribute them then they will not work because the person getting the
samples will not have my project.

I would have to change the VB project anyway so I might as well switch
between the debug and release version of the external assembly DLL.

It is hard to believe that VB does not have a way to build using
different parameters from one project. But I guess it is so?

Bruce
 
M

Michel Posseth [MCP]

Why not use conditional compilation contstants when loading the assembly ?

like this


# IF DEBUG THEN
# ELSE
# END IF

regards

Michel
 
B

Bruce

Michel said:
Why not use conditional compilation contstants when loading the assembly ?

like this


# IF DEBUG THEN
# ELSE
# END IF

regards

Michel

Thanks Michel,

Where do I put this? All I see is a list of references. I am not a VB
programmer, I am a C++ programmer trying to write some sample code for
my C++ assembly.

Bruce
 
J

Jay B. Harlow (Jay.Harlow

Bruce,
In addition to the other comments.
It is hard to believe that VB does not have a way to build using
different parameters from one project. But I guess it is so?
VB *does* have a way to build using different parameters!

However by default it is turned off. Use "Tools - Options - Projects
and Solutions - General - Show Advanced Build Configurations" to enable
or disable the feature. Once you enable this option you will have both
Release & Debug builds available.

The caveat is, there are not different References based on Release &
Debug builds per se.

What I normally do is use output folders to hold my Release & Debug
builds of my C++, VB, or C# projects, rather then use file names. Then
I will put the C++, VB, or C# projects all in one solution. Where each
project references the other project, *by project* (not file!) This way
the Release build of the VB project will use the output of the Release
build of the C++ project, likewise the Debug build of the VB project
will use the output of the Debug build of the C++ project. Considering
that I build the entire solution...

Having said that I suspect (but have not tested) that you could change
the output name of the C++ assembly within the respective Debug or
Release configuration & the respective VB build will respectively use
named C++ assembly. Again based on using Project references within a
solution & not file references. Again I have not tested this theory.

--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
 
M

Michel Posseth [MCP]

Well you could implement a interface , and load the assembly dynamicly
through code ( by implementing an interface you keep intellisense )

with the method i described ( with conditional compilation contstants )

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vadirIf.asp

I use this method since VB6 in my projects as i had a lot of customers with
different wishes but the basic source of most of my programs is just one
sourcecode
as i did not want my progies to get bloated by unnecesary source from wishes
of differnt customers i implemented coditional compilation .

So building your proggy with the debug switch on will result in a different
code flow in your application

hth

regards

Michel
 

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