Share via


Configuring Selective Builds for a Project (Windows CE 5.0)

Send Feedback

You can configure a project to selectively build source code depending on the current workspace that contains the project.

To do this, you can modify the sources file for the project to add a conditional compiler statement before creating the sections of source code that you want to depend on the statement.

To configure selective builds for a project

  1. If the project you want to modify is not in your workspace, to add it, from the Project menu, select Insert and choose the Platform Builder project (.pbpxml) file you want to add.

  2. Choose OK.

  3. To open the sources file for the project, select it in the Workspace window, on the FileView tab, and then from the shortcut menu, choose Open.

  4. Enter the following code statement in the file:

    CDEFINES=$(CDEFINES) -d$(_TGTPROJ) 
    

    This passes a conditional statement to the compiler, where %_TGTPROJ% is the name of the workspace.

  5. From the File menu, choose Save to save your changes.

  6. To write source code for your project based on the conditional statement that you inserted, enclose the code in #IFDEF and #ENDIF statements using the format in the following code example, written for a project included in a workspace named MyOSDesign..

    #ifdef myosdesign
    //do something
    #endif
    
  7. When you are ready to run a build of your project, from the Build Project menu, verify that Clean Before Building and Copy Files to Release Directory After Build are selected.

  8. From the Build Project menu, select Build Current Project.

    This performs a clean build of your project, decreasing the possibility of build errors appearing due to existing files from an earlier build.

See Also

Projects | CDEFINES | Build Project Menu Options | Miscellaneous Environment Variables

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.