Defining Console Projects

Console projects define a project which will run underneath a terminal or command prompt. Protobuild itself is an example of a console application.

Generated projects

Console projects should be used when you don’t have a graphical interface to present to the user, or you want to show console output on Windows.

For Windows, Mac OS X and Linux, these projects are generated as Console Applications (as shown in Visual Studio under the project properties).

For iOS and Android, these projects are generated as Xamarin iOS and Xamarin Android applications respectively. For Ouya, we generate these projects as an Android application. Since console applications are unlikely to have the required files to work on these platforms when built, you most likely need to limit the platforms that your console applications are generated for (refer to Limiting platforms).

For Windows8, WindowsPhone and WindowsPhone81 we generate the appropriate project types as specified by Microsoft for these platforms. Since console applications are unlikely to have the required files to work on these platforms when built, you most likely need to limit the platforms that your console applications are generated for (refer to Limiting platforms).

For the Web, these projects will have a post-build step that runs JSIL, which in turn produces Javascript and HTML documents to run the application in a web browser.

Basic structure

The smallest definition for an console project you can have is shown below.

<?xml version="1.0" encoding="utf-8"?>
<Project Name="MyConsole" Path="MyConsole" Type="Console">
  <References>
    <Reference Include="System" />
    <Reference Include="System.Core" />
  </References>
  <Files>
    <Compile Include="Program.cs" />
  </Files>
</Project>

The presence of Type="Console" ensures this project is an console project.

Project definition location

All project definitions for your module should be placed under the Build\Module directory and have a .definition extension. The name of the project should match the name of the file as well; for a project called “MyProject”, the project definition should reside at Build\Module\MyProject.definition.

Tip

This is the location for all project definitions, including application, console, library, content, include and external projects.

Common sections

All of the sections for console projects are identical to those found in application projects. Refer to the following sections under the Defining Application Projects documentation: