473,320 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

.NET refuses to update due to dual directories?

Why whenever I create a project in c#, when I compile it, it has got the
resulting executable TWICE in TWO different directories - obj\debug and
bin\debug. WHY?
Sometimes when I'm trying to debug it, when I press F5 the one that's
running is obviously not the same one to the one that i've just made changes
to, as it doesn't seem to update my changes. Why does it do this stupid
behaviour?
Nov 16 '05 #1
2 1216
yes, there are two different directories.

When you are running an EXE, it runs from the bin directory. If you want to
make a reference to an assembly (DLL) from another application, you should
reference the copy in the obj directory.

This is because the bin directory contains the EXE and a copy of every dll
you referenced. If you are making a DLL, then copies of the referenced DLLs
are copied in there as well. If you reference a dll from a bin directory,
and other dlls that you reference are also in that bin directory, your app
will use them instead of picking them up from their own directory. As these
are copies of the dlls, you could end up getting the wrong one.

This means you could make a change to a DLL, recompile just the dll you
changed, then switch over to the EXE to debug your change, and you EXE won't
pick up the change, because you referenced another object in the BIN
directory, and it had made a copy of the old dll, and that's what your app
is referencing.

These directories are on purpose. They are important. Don't confuse them.

On the other hand, if you are making a stand-alone exe, with no assemblies
that you wrote, and you are debugging it, I do not believe that it is
possible for the debugger to be placing a breakpoint in the wrong one...
which is how I interpret your complaint.

Not sure what you mean by referring to VS as "stupid."

I hope this helps,
--- Nick

"Beeeeeves" <beeeeeeeeev@ves> wrote in message
news:Om**************@TK2MSFTNGP12.phx.gbl...
Why whenever I create a project in c#, when I compile it, it has got the
resulting executable TWICE in TWO different directories - obj\debug and
bin\debug. WHY?
Sometimes when I'm trying to debug it, when I press F5 the one that's
running is obviously not the same one to the one that i've just made changes to, as it doesn't seem to update my changes. Why does it do this stupid
behaviour?

Nov 16 '05 #2
> When you are running an EXE, it runs from the bin directory. If you want
to
make a reference to an assembly (DLL) from another application, you should
reference the copy in the obj directory.
OK, thanks - I didn't know this rule!

This is because the bin directory contains the EXE and a copy of every dll
you referenced. If you are making a DLL, then copies of the referenced DLLs are copied in there as well. If you reference a dll from a bin directory,
and other dlls that you reference are also in that bin directory, your app
will use them instead of picking them up from their own directory. As these are copies of the dlls, you could end up getting the wrong one.
So, presumably if you have a DLL project and a main EXE project, then the
DLL project should have its output location set to the 'obj' directory of
the main exe?

This means you could make a change to a DLL, recompile just the dll you
changed, then switch over to the EXE to debug your change, and you EXE won't pick up the change, because you referenced another object in the BIN
directory, and it had made a copy of the old dll, and that's what your app
is referencing.

These directories are on purpose. They are important. Don't confuse them.
On the other hand, if you are making a stand-alone exe, with no assemblies
that you wrote, and you are debugging it, I do not believe that it is
possible for the debugger to be placing a breakpoint in the wrong one...
which is how I interpret your complaint.
I'm pretty sure it is still doing this... I have now got no DLLs and one
main EXE.


Not sure what you mean by referring to VS as "stupid."
I'll do it to those rules and see if it helps. Thanks


I hope this helps,
--- Nick

"Beeeeeves" <beeeeeeeeev@ves> wrote in message
news:Om**************@TK2MSFTNGP12.phx.gbl...
Why whenever I create a project in c#, when I compile it, it has got the
resulting executable TWICE in TWO different directories - obj\debug and
bin\debug. WHY?
Sometimes when I'm trying to debug it, when I press F5 the one that's
running is obviously not the same one to the one that i've just made

changes
to, as it doesn't seem to update my changes. Why does it do this stupid
behaviour?


Nov 16 '05 #3

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

Similar topics

9
by: Tomer Ben-David | last post by:
Hi I have a big j2ee appliction that was so forth run on a single cpu machine. I have tested it on a dual cpu machine, its running much slower (about X3 times slower). I know that...
3
by: Arthur | last post by:
Hey Everyone, Is this an Oracle bug? Here is my cursor statement: CURSOR tax_portal_cursor IS SELECT * FROM web_payment@remotedb WHERE caps_code IN ( SELECT * FROM TABLE(CAST(l_caps_codes...
3
by: Mark A Framness | last post by:
Greetings, I am working on a project and we need to write a conversion script to initialize a new field on a table. The number of records on this table is on the order of millions so routine...
12
by: Andrew Baker | last post by:
What is the best way to lock an individual row in the following scenerio: --TODO - LOCK THIS ROW -- Return the next id SELECT next_id INTO next_id_out FROM owner.my_id_table WHERE app_id =...
2
by: ajay | last post by:
How to write a single update sql statement to update different set of attributes of a table. In other words what will be the value of indicator variables to ignore updates of some attributes in a...
5
by: John Dalberg | last post by:
I am planning to build a server to be used as a SQL Server and web server. Right now I can only use a single box for both. I have read some threads were dual processors are having problems with...
10
by: Craig Keightley | last post by:
I have the following array: function showCPUs(){ //name brandID dualCore dualProcessor var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=;
1
by: Riley DeWiley | last post by:
I have an UPDATE query that is always setting 0 records. When I cut and paste the SQL into Access and use it, it fails in the same way unless I coerce the date fields to be '=now()', in which case...
3
by: sam | last post by:
Hi.. I'm looking to install dual versions of python 2.3, 2.4 on the same box. I'm trying to figure out if there's something I'm missing, some kind of gotchas that I haven't seen. I'm also...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.