Can I convert a Win32 application project to a console application?

Is it possible to convert an existing visual studio project file that creates a Win32 application into a project file that creates a Win32 Console application? If so, how is this done? I searched googled and found many people doing the opposite, but not so.

+7
visual-studio console
source share
4 answers

At the linker level, a distinction is made with the /SUBSYSTEM on the linker . However, since there are many other things in Visual Studio created around a project type, it is sometimes easiest to create a new project in console mode and add existing code to a new project.

+12
source share

I do not know about the automatic way of doing this. I think you can change all project settings to make this switch. But that would be tiring. I believe that it would be easier to just create a new project and add the source files to it.

+1
source share

You do not indicate your version of the visual studio. In versions with XML project definitions, you can change the XML. Hell, you could do it with XSLT. In an older version, you better create a new project.

You must create two simple projects (one GUI, one Console) and compare the XML files for the project definition to see what needs to be done.

0
source share

Maybe, but it depends on how the application was archived. If design is one that clearly separates business logic from presentation, you can extract the code and business logic classes into a separate library if you have not already done so. Once this step is completed, you will need to create a new API for this library so that the console application (or any other application) can use it.

On the other hand, if the forms contain business logic, these processes will need to be pulled into new classes without presentation and included in your new libraries. Like I said ... maybe, but it can be a lot of work.

0
source share

All Articles