473,897 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C++ debug/release builds and project references

I am having trouble getting debug and release builds to work properly
with project references using C++ .NET and Visual Studio 2003.

I created a test solution, with a basic Windows form C++ project.
I then add a class library, and add a reference to this project in the
first project.

When I do a release build, I see the following in the output from the
DLL compile:
/OUT:"C:\Documen ts and Settings\Andrew \My Documents\Visua l Studio
Projects\Depend encyTest\Releas e\test.dll"

OK so far.

When the windows form app compiles, however, I see:
/FU "c:\Documen ts and Settings\Andrew \My Documents\Visua l Studio
Projects\Depend encyTest\Debug\ test.dll"

Where does this "Debug" come from? Everywhere else in the output says
"Release".

Can anyone tell me what I am doing wrong? How can I use a debug
version of a DLL for a debug build, and a release version for the
release build?
--
Andrew Rowley
Feb 1 '07 #1
6 9151
I am having trouble getting debug and release builds to work properly
with project references using C++ .NET and Visual Studio 2003.

I created a test solution, with a basic Windows form C++ project.
I then add a class library, and add a reference to this project in the
first project.

When I do a release build, I see the following in the output from the
DLL compile:
/OUT:"C:\Documen ts and Settings\Andrew \My Documents\Visua l Studio
Projects\Depend encyTest\Releas e\test.dll"

OK so far.

When the windows form app compiles, however, I see:
/FU "c:\Documen ts and Settings\Andrew \My Documents\Visua l Studio
Projects\Depend encyTest\Debug\ test.dll"

Where does this "Debug" come from? Everywhere else in the output says
"Release".

Can anyone tell me what I am doing wrong? How can I use a debug
version of a DLL for a debug build, and a release version for the
release build?
Hi,

How did you add the reference?
Did you select the DLL by browsing to it, or did your use the 'projects' tab
in the references dialog?

Also, if you open build->configuratio n manager
you can see how the debug / release builds are configured.
It could be possible that your solution release config is set to use the
release project setting for one project and the debug setting for another.

--
Kind regards,
Bruno.
br************* *********@hotma il.com
Remove only "_nos_pam"

Feb 1 '07 #2
je***@online.mi crosoft.com ("Jeffrey Tan[MSFT]") wrote:
>I have following questions to your problem:
1. Is your class library in configuration "Release"?
2. How do you add reference in the Winform project? Do you add the class
library dll in "Projects" tabpage(this is what I used in the test projects)
or browse to the ManagedClassLib .dll directly and add it as reference? I
suspect if you add the ManagedClassLib .dll in the debug folder.

I have also attached my sample test project in this reply. You may download
it through Outlook Express (not IE). You may give it a rebuilding on your
side and see if the "BuildLog.h tm" still has this problem. Thanks.
Hi Jeffrey,

Thanks for the quick reply.

I'm not sure I understand your first question - the class library is
in configuration "release" when I have set the solution to release.

I added the reference in the projects tab page.

I downloaded your sample onto my machine and built it. However, before
building anything I changed the configuration to "Debug", since it
opened set to "Release". When I built the debug build, it failed when
it tried to reference the release dll. Output is below.

When I closed and reopened the solution, it built debug correctly -
which was what it was set to when it opened. If I then switch to
release, it builds, but refers to the debug dll.

Maybe I have something set strangely? You mentioned Ctrl+Shift+B to
build - I do F7 or select Build->Rebuild Solution - Ctrl+Shift+B
doesn't do anything for me.

Output from first build, with configuration set to debug:

Creating temporary file
"c:\tmp\Managed Winform\Managed ClassLib\Debug\ RSP000001.rsp" with
contents
[
/Od /AI "C:\tmp\Managed Winform\Managed Winform\Debug" /D "WIN32" /D
"_DEBUG" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MTd /GS /Yu"stdafx.h"
/Fp"Debug/ManagedClassLib .pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Zi /clr /TP /FU
"C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \mscorlib.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Data.dl l" /Zl
..\ManagedClass Lib.cpp
..\AssemblyInfo .cpp
]
Creating command line "cl.exe
@c:\tmp\Managed Winform\Managed ClassLib\Debug\ RSP000001.rsp /nologo"
Creating temporary file
"c:\tmp\Managed Winform\Managed ClassLib\Debug\ RSP000002.rsp" with
contents
[
/Od /AI "C:\tmp\Managed Winform\Managed Winform\Debug" /D "WIN32" /D
"_DEBUG" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MTd /GS /Yc"stdafx.h"
/Fp"Debug/ManagedClassLib .pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Zi /clr /TP /FU
"C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \mscorlib.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Data.dl l" /Zl
..\Stdafx.cpp
]
Creating command line "cl.exe
@c:\tmp\Managed Winform\Managed ClassLib\Debug\ RSP000002.rsp /nologo"
Creating command line "rc.exe /fo"Debug/app.res" .\app.rc"
Creating temporary file
"c:\tmp\Managed Winform\Managed ClassLib\Debug\ RSP000003.rsp" with
contents
[
/OUT:"C:\tmp\Man agedWinform\Man agedWinform\Deb ug\ManagedClass Lib.dll"
/INCREMENTAL /NOLOGO /DLL /DEBUG /ASSEMBLYDEBUG
/PDB:"C:\tmp\Man agedWinform\Man agedWinform\Deb ug/ManagedClassLib .pdb"
/FIXED:No /noentry nochkclr.obj mscoree.lib kernel32.lib user32.lib
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "\Program
Files\Microsoft Visual Studio .NET 2003\Sdk\v1.1\L ib\mscoree.lib"
..\debug\Assemb lyInfo.obj
..\debug\Manage dClassLib.obj
..\debug\Stdafx .obj
..\debug\app.re s
]
Creating command line "link.exe
@c:\tmp\Managed Winform\Managed ClassLib\Debug\ RSP000003.rsp"

Output Window
Compiling...
Stdafx.cpp
Compiling...
ManagedClassLib .cpp
AssemblyInfo.cp p
Generating Code...
Compiling resources...
Linking...
nochkclr.obj : warning LNK4099: PDB 'libc.pdb' was not found with
'c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\lib\no chkclr.obj' or at
'C:\tmp\Managed Winform\Managed Winform\Debug\l ibc.pdb'; linking object
as if no debug info

Results
Build log was saved at
"file://c:\tmp\ManagedW inform\ManagedC lassLib\Debug\B uildLog.htm"
ManagedClassLib - 0 error(s), 1 warning(s)
------- Build started: Project: ManagedWinform, Configuration:
Debug|Win32 -------

Command Lines
Creating temporary file
"c:\tmp\Managed Winform\Managed Winform\Debug\R SP000004.rsp" with
contents
[
/Od /AI "C:\tmp\Managed Winform\Managed Winform\Debug" /D "WIN32" /D
"_DEBUG" /D "_MBCS" /FD /EHsc /MTd /GS /Yu"stdafx.h"
/Fp"Debug/ManagedWinform. pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Zi /clr /TP /FU
"c:\tmp\managed winform\managed winform\release \ManagedClassLi b.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \mscorlib.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Data.dl l"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Drawing .dll"
/FU
"C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Windows .Forms.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.XML.dll "
..\Form1.cpp
..\AssemblyInfo .cpp
]
Creating command line "cl.exe
@c:\tmp\Managed Winform\Managed Winform\Debug\R SP000004.rsp /nologo"
Creating temporary file
"c:\tmp\Managed Winform\Managed Winform\Debug\R SP000005.rsp" with
contents
[
/Od /AI "C:\tmp\Managed Winform\Managed Winform\Debug" /D "WIN32" /D
"_DEBUG" /D "_MBCS" /FD /EHsc /MTd /GS /Yc"stdafx.h"
/Fp"Debug/ManagedWinform. pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c
/Zi /clr /TP /FU
"c:\tmp\managed winform\managed winform\release \ManagedClassLi b.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \mscorlib.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Data.dl l"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Drawing .dll"
/FU
"C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Windows .Forms.dll"
/FU "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.XML.dll "
..\stdafx.cpp
]
Creating command line "cl.exe
@c:\tmp\Managed Winform\Managed Winform\Debug\R SP000005.rsp /nologo"

Output Window
Compiling...
stdafx.cpp
stdafx.cpp(0) : fatal error C1192: #using failed on
'c:\tmp\managed winform\managed winform\release \ManagedClassLi b.dll'

Results
Build log was saved at
"file://c:\tmp\ManagedW inform\ManagedW inform\Debug\Bu ildLog.htm"
ManagedWinform - 1 error(s), 0 warning(s)

regards

Andrew Rowley
--
Andrew Rowley
Feb 1 '07 #3
Bruno van Dooren [MVP VC++] <br************ **********@hotm ail.com>
wrote:
>How did you add the reference?
Did you select the DLL by browsing to it, or did your use the 'projects' tab
in the references dialog?
I used the projects tab in the references dialog.
>Also, if you open build->configuratio n manager
you can see how the debug / release builds are configured.
It could be possible that your solution release config is set to use the
release project setting for one project and the debug setting for another.
The release configuration is set to release for both projects, and the
debug configuration is set to debug for both projects.

See my reply to Jeffery - it might be happening only when I change
from one to the other, and seems to be a problem in either direction.

I suspect it has been happening to me for a long time, but went
unnoticed because there was always a debug and release dll there. I
think it only started causing me problems when I used strong names,
and ran into problems with mismatched version numbers.

Regards

Andrew Rowley
--
Andrew Rowley
Feb 1 '07 #4
Hi Andrew,

Thanks for your feedback.

Oh, yes, after following your steps, I can reproduce this problem
sometimes. Further research shows that this is a known issue of VS.net2003
project references, which has been fixed in VS2005(Whidbey) .

In the bug record, the preferred work around is to use the /FU switch
directly through the project settings rather than using project references.

Personally, I find the following steps work for me:
1. after switching the config to "Release", click the "ManagedClassLi b"
under the "References " node in "Solution Explorer". Check in the
"Properties " window that the "Full Path" points to the "release" dll.
2. First, right click the "ManagedClassLi b" project and select "Rebuild"
menu item.
3. Then, right click the "ManagedWinform " project and select "Rebuild" menu
item.

Normally, these steps work well for me. You may give it a try.

Finally, I recommend you upgrade to the VS2005 IDE, which has fixed a lot
of bugs of VS.net2003. Also, VS2005 keeps a good backward compatibility
with VS.net2003 projects.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
Feb 2 '07 #5
Thanks for the information. At least I now know what's going on, and
won't spend so much time chasing around in circles :-)

je***@online.mi crosoft.com ("Jeffrey Tan[MSFT]") wrote:
>In the bug record, the preferred work around is to use the /FU switch
directly through the project settings rather than using project references.
This worked well for the class library, unfortunately I also have a
user control with the same issue, and removing the project reference
stops the form designed from working. I guess I can build it
separately and just reference the release build, but it makes
debugging more tedious.
>Personally, I find the following steps work for me:
1. after switching the config to "Release", click the "ManagedClassLi b"
under the "References " node in "Solution Explorer". Check in the
"Properties " window that the "Full Path" points to the "release" dll.
2. First, right click the "ManagedClassLi b" project and select "Rebuild"
menu item.
3. Then, right click the "ManagedWinform " project and select "Rebuild" menu
item.

Normally, these steps work well for me. You may give it a try.
What I'm looking for is a solution I can set and forget, so this is
not ideal.
>Finally, I recommend you upgrade to the VS2005 IDE, which has fixed a lot
of bugs of VS.net2003. Also, VS2005 keeps a good backward compatibility
with VS.net2003 projects.
I am switching to VS2005 for a new project, but I need to target .NET
1.1 with the current project. My understanding is that using VS2005 I
can't target .NET 1.1 with C++ - is that correct?
>Hope this helps.
Very much, thanks.
--
Andrew Rowley
Feb 2 '07 #6
Hi Andrew,

Thanks for your feedback!

Yes, I see your concern. My suggestion is using VS.net2003 designer without
considering this issue, and after finishing the coding to the stage of
final building, you may use the /FU switch directly to target the correct
project configuration.

Yes, VS2005 can not build application with .Net Framework1.1. The only
solution to tell VS2005 to use .Net Framework1.1 is using MSBee. Please
refer my original thread below(take care of the URL line-break):
http://groups.google.com/group/micro...es.csharp/brow
se_frm/thread/a95a7b5d5ca4ece a/78224b3d8d29fc2 1?lnk=st&q=targ et+%22Jeffrey+T
an%22+VS2005+ms build&rnum=1#78 224b3d8d29fc21

Normally, .Net2.0 keeps a maximize backward compatibility with .Net1.1, so
in most situation you will not have no problem compiling .Net1.1 projects
with VS2005. The link below contains more details:
http://groups.google.com/group/micro...es.csharp/msg/
01b57f2f6f64bc4 8

If you still need any help or have any concern, please feel free to tell
me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 5 '07 #7

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

Similar topics

1
3561
by: Eyal | last post by:
Hi, We have an issue with Debug Assertion showing in Release builds in Managed C++! I have created a small managed C++ project that looks like this: #include "stdafx.h" #using <mscorlib.dll> #using <System.dll> using namespace System; int _tmain()
1
1683
by: Eddy | last post by:
Problem: In 'solution A', 'project 1' references 'project 2'. As such, when 'solution A' is built (debug mode), project '1' creates a dll in /debug, and project '2' referneces that dll. All is good. When 'solution A' is built in release mode however, 'project 1' is recompiled and the new dll is put into '/release', but 'project 2' still references the dll from project '1's /debug folder, and as such is compiled using the older /debug version of...
1
1514
by: _BNC | last post by:
Well, it started as a series of tools for supporting a project, but I've got a large number of project directories with .SLN files that are used by a rapidly-growing EXE. First question: What is the easiest way to switch between debug and release builds? Each of the support assemblies will have to be compiled in release form, and presumably all references will have to be re-pointed at the release directories. Not a simple chore,...
6
4125
by: swartzbill2000 | last post by:
Hello, I have a VB 2005 Express project with a TraceListener-derived class to route Debug.Print output to a log file. It works fine for Debug builds. What is the correct combination of changes to make it work in Release build? Bill
3
15531
by: Bob Johnson | last post by:
It is my understanding - and please correct me if I'm wrong - that when building a project in debug mode, I can deploy the .pdb file along with the ..exe and thereby have access to the specific line number of code that throws an exception. Specifically, I can have an error logging routine that, amongst other things parses the call stack and tells me the specific line of code that choked. It is also my understanding that if building in...
3
2007
by: TBass | last post by:
Hello, Is there a way to get Visual Studio 2003 look to one directory for debug version dlls when set to DEBUG and then to another directory where I store the release version of a dll when set to RELEASE? My current project uses about 8 dlls I've written in the past, but I don't want to keep re-compiling them for debug/release depending on whether I'm compiling the current project for debug/release.
6
2394
by: =?Utf-8?B?SHVnaA==?= | last post by:
Hi there We are trying to build a C sharp solution in Visual Studio 2005 Professional. We have a number of other assemblies, that do not form part of the solution. Assemblies that do form part of the solution have been referenced using the Projects tab in the Add Reference dialog. Assemblies that do not form part of the solution have been added usingthe
5
1805
by: Andy B | last post by:
How do you tell vs2005 to keep debug info out of your release builds? When I build a release and a debug version, there seems to be no difference in them at all...The release builds still have the debug databases with them...
1
1439
by: Jeff Dege | last post by:
When I am building a project in Visual Studio 2005, I can create references to assemblies that were built by other projects. The problem is that I don't see how to create a reference that switches between the debug and release builds of the other project, when I switch between the debug and release configurations of my parent project. That is, when I'm building, running, and of course debugging a project, I want to use the debug...
0
9990
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9837
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,...
0
11250
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10850
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10941
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
7185
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();...
0
5873
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4698
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
3
3300
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.