Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6698641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:36:07+00:00 2026-05-26T06:36:07+00:00

I am programming an application using the command line application output type to display

  • 0

I am programming an application using the command line application output type to display debug information in the console while MOGRE is handling the actual window creation. I would like to hide the console when compiling the application for release. Not showing the console can easily be done by going into the project properties, the application tab and change the output type to windows application. When doing that only the MOGRE window will be shown.

While I believe it would be cleaner to create a windows application and attach a console to it when one wants that behavior I am still curious weather it is possible to do this programmatically.

That is, is there a way to programmatically determine that when compiling in debug mode the application compiles as command line application and when in release mode it compiles as windows application? And if so, how could it be done?

Edit: I am not asking how to attach a console to a windows forms application. I put the important part in italics out of hope that will make clearer what I want.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:36:08+00:00Added an answer on May 26, 2026 at 6:36 am

    You can achieve this if you edit the .csproj manually:

    • Right click on the project node in Solution Explorer
    • Select “Unload Project”
    • Right click on the project node in Solution Explorer
    • Select “Edit MyApp.csproj”

    Move the <OutputType ../> property group Xml element from the <PropertyGroup .../> Xml element without Condition to the property group with conditions corresponding to build configuration / platform.

    Before:

    <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        ...
        <OutputType>Exe</OutputType>
        ...
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        ...
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
        ...
      </PropertyGroup>
    

    After:

    <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        ...
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        ...
        <OutputType>Exe</OutputType>
        ...
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
        ...
        <OutputType>WinExe</OutputType>
        ...
      </PropertyGroup>
    

    And finish:

    • Right click on the project node in Solution Explorer
    • Select “Reload Project”

    Here is a proof example:

    class Program
    {
        public static void Main(string[] args)
        {
    #if DEBUG
            Console.WriteLine("test");
    #else
            Application.Run(new Form1());
    #endif
        }
    }
    

    It works, but I don’t think this is officially supported, so use at your own risk 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question occured to me while programming a Android application, but it seems to
I'm using the exact code from the iPhone Application Programming Guide Multimedia Support to
i am programming a concurrent (multi-threaded) server application - using pthread, of cource!- when
I am programming the admin part of a Swing application using WindowBuider, it would
I am trying to build a Linked list application using C++ programming language &
I am programming a simple client/server application using Java-RMI. I would like to know
I'm programming an application in MFC (don't ask) and I have a CEdit box
I'm programming an application for a 32 bit processor with limited memory (512k flash,
I'm relatively new to web application programming so I hope this question isn't too
I am a meganoob in iPhone Application programming. All I want to do is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.