What is the difference between debug mode and release mode?

Can anybody help me with the difference between release mode and debug mode!!
I have no idea of what they are and their significance.

[152 byte] By [sigme] at [2007-12-17]
# 1
Debug and Release are different configurations for building your project. As the name implies, you generally use the Debug mode for debugging your project, and the Release mode for the final build for end users. The Debug mode does not optimize the binary it produces (as optimizations can greatly complicate debugging), and generates additional data to aid debugging. The Release mode enables optimizations and generates less (or no) extra debug data.

Hope this helps,
-Tom Meschter
Software Dev, Visual C# IDE

TomMeschter at 2007-10-6 > top of Msdn Tech,Visual C#,Visual C# General...
# 2
Also, changing from Debug to Release mode can screw up directory access, I've noticed. I had an application that always accessed a particular subdirectory. Always worked great until I changed to release mode and did the build. Maybe someone can explain why?
BryanMiller at 2007-10-6 > top of Msdn Tech,Visual C#,Visual C# General...
# 3
Because the release and debug versions run from different folders, then any code that uses relative paths may behave differently, because the relative paths may be different.

MatthewWatson at 2007-10-6 > top of Msdn Tech,Visual C#,Visual C# General...
# 4
So, it's simply a matter of changing the relative path before Release? For example, I have an application that opens files using an openFileDialog control. I have two string variables, declared right after the "required designer variables", that I initialize in the form's constructor.

int myindex = Application.ExecutablePath.IndexOf("Debug");

app_directory = Application.ExecutablePath.Substring(0,myindex+6);

contacts_directory = app_directory + "Contacts\\";

Now, I then use string variable contacts_directory in the btnOpen_Click( ) event to specify the Contacts subdirectory of the application directory:

fileDialog.InitialDirectory = contacts_directory;

So, it's simply a matter of:

fileDialog.InitialDirectory = contacts_directory;

Now, never mind the fact that .InitialDirectory doesn't work right except for the first time btnOpen_Click( ) is used after the application starts. That's a separate issue that I know many, many people have complained about.

It sounds like what I need to do before building the Release is change "myindex" above to:

int myindex = Application.ExecutablePath.IndexOf("Release");

substituting "Release" for "Debug". It seems like if folders Debug and Release are on the same level, and each contains a Contacts subdirectory, that this substitution would suffice. But it does not. I get the following runtime error in debug mode:

<img src="http://www.geocities.com/kyrathaba/inline_images/app_error.JPG">

What is this "C:\DoContacts" directory?

BryanMiller at 2007-10-6 > top of Msdn Tech,Visual C#,Visual C# General...
# 5

Also, I have a question for the release.

After I release my project, the executable file is only run with the machine that I compile it. If I take that file and run with a different PC, it gives me an error message as below.

"This Application has failed to start because the application configuration is incorrect. Reinstalling the application may fix the problem. "

mman06 at 2007-10-6 > top of Msdn Tech,Visual C#,Visual C# General...
# 6
the other PC should have the correct version of the .NET Framework installed in order to run the application. What happens if you run it in debug mode? (compile in debug mode, then run that app on the other computer).
ahmedilyas at 2007-10-6 > top of Msdn Tech,Visual C#,Visual C# General...
# 7

From debug mode, it stll gives the same error.

How do I install .Net Framework?

Thanks

mman06 at 2007-10-6 > top of Msdn Tech,Visual C#,Visual C# General...
# 8

you can either create a setup and deployment project in the full VS.NET (non express) which will download and install the .NET Framework automatically, and install your application.

download .NET Framework 2.0:

http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en

ahmedilyas at 2007-10-6 > top of Msdn Tech,Visual C#,Visual C# General...
# 9
When you take the file to a different PC, do you take with it the configuration file? (YourApp.exe.config)
JamesCurran at 2007-10-6 > top of Msdn Tech,Visual C#,Visual C# General...