views:

40

answers:

3

I have inherited a Windows Forms application and I have found that a .EXE file gets generated into the obj\Debug folder everytime I compile.

I am more a Web Forms kind of developer so I am a little confused as to what is happening here. Why is it a .EXE and not a .DLL? What does this file actually represent? Is this the default behaviour for Windows Forms applications? Or, did my predecessor have to set it up up somehow?

As far as I can tell, the solution does not have a deployment project.

A: 

Why would it be a DLL? It's an application - it has to be launchable, unlike a website which lives "inside" a web server (effectively). The exe file is the application (along with any libraries it requires, of course). You double-click on it, it will launch the application. No problem.

Having said that, you should pretty much ignore the obj directory - it's just an intermediate directory. The bin directory is the one you should be taking build results from.

Jon Skeet
+1  A: 

Why this is a problem? Console application projects have exe file in the obj/Debug folder too. The obj folders are NOT used for running the application - they are used for creating the end binaries in the bin folders.

If the question is about exe vs dll then compiled exe file is used to run the application. In the web environment you used dll because ASP.NET new how to run code from it. But Windows knows how to run exe files, so any of your code actually can be compiled to an executable.

Andrew Bezzub
Thanks for the answer. It's not a problem, I was curious as to whether this is default behaviour for Win Forms apps and wanted to get a better understanding of what was happening. Your answer helped me understand it more.
Andrew
+1  A: 

Every application be it web or windows would have an entry-point for execution. Anything in compiled form in .Net is an assembly which need not always be a DLL file. An EXE file is a .Net assembly with an entry point and few headers in the beginning of the file that identifies itself as a stand-alone executable to the windows operating system. In case of your web-application your asp.net pages are the entry points that users would type in a browser and start the application. In case of a stand-alone windows forms desktop application, it is an EXECUTABLE file, which user can click on run.

I am more a Web Forms kind of developer so I am a little confused as to what is happening here. Why is it a .EXE and not a .DLL?

Having said this, It is also important to note that, just like the asp.net is not the only platform to develop web-applications [you have php, jsp, etc.], .Net windows forms is also not the only way to create stand-alone executables. You can make EXEs in C, C++, VB, Delhpi, etc. only difference would be that they will not be .Net assemblies but all of them including .Net executables will have an entry-point to start execution from and the EXE header that identifies them as executables on the host windows operating system.

this. __curious_geek