Create Your Application as a Platform Builder Subproject (Compact 7)
3/12/2014
You can create an application project within an existing OS design project. An application project created by using this workflow is called a Platform Builder subproject. This workflow assumes that you will download the OS image to the target device or to a virtual CEPC by using Platform Builder and then run your application from Microsoft Visual Studio 2008 each time you want to test a change.
Tip
If you do not have Platform Builder, and you plan to test your application on a stand-alone virtual CEPC that includes the OS image on a virtual drive or on a device that has the OS image in flash memory, use the procedure in Create Your Application Using an SDK for an OS Image instead.
Prerequisites
To complete the following procedure, you must:
- Include Platform Builder when you install Windows Embedded Compact 7. Platform Builder is an add-in to the Visual Studio integrated development environment. For more information, see Installation.
- Create an OS design project or have access to one. For more information, see Design Your First OS or Create an OS Design.
- Have access to the virtual CEPC or device for which the OS was designed. With a virtual CEPC, you will be able to test most of your application on your computer instead of on the device, until you are further along in the development cycle when it becomes more important to test directly on the device. For information about creating a virtual CEPC, see Develop with Virtual CEPC.
To create an application subproject in the OS design project
In Visual Studio, open the project for the OS design.
The following image shows a user-created project named VCEPC_SL_onVdrive that is open in Solution Explorer in Visual Studio.
Optional. View the features of Windows Embedded Compact that have been included in the OS design to ensure that the ones you want to use in your application are selected. You can view them in the Catalog Items View window.
For example, the following image shows catalog items that are selected in the User Interface node. Because the Mouse catalog item is selected, your application will be able to respond to mouse clicks.
As another example, if you want your OS design to include support for Microsoft Silverlight for Windows Embedded applications, the **Silverlight for Windows Embedded ** catalog item must be selected.
Tip
For information about how to add catalog items to the OS design, see Design Your First OS. To determine which catalog items to add for a feature, see the reference topic "Catalog Items and Sysgen Variables" for the feature that you want to include. For example, to add common UI elements to your OS design, see the topic Common Controls Catalog Items and Sysgen Variables in the Reference section of the Help documentation. If someone on your team is responsible for designing the OS, you might want to let them know that you need a specific catalog item added to the OS design.
If you have not already done so, or if you have changed the OS design project by modifying catalog items or configuration properties, save all your project files and build the OS design to create a run-time image in preparation for downloading the OS image to the device or virtual CEPC. On the Build menu, click Build Solution. After the build completes, click Make Run-Time Image on the Build menu.
Tip
You can configure Visual Studio to create a new run-time image each time you build your OS design project. On the Build menu, point to Targeted Build Settings, and then select Make Run-Time Image After Building, as shown in the following image.
Optional. If you are converting a Microsoft Expression Blend 3 project into a Silverlight for Windows Embedded project, first create a Windows Embedded Compact-compatible project template from the Expression Blend project. To create a compatible project template, on the Tools menu, point to Windows Embedded Silverlight Tools, and then click Create Platform Builder Subproject.
Complete the steps of the Create Platform Builder Subproject wizard and make a note of the location where your converted project is saved. For detailed information, see Convert an Expression Blend Project to a Silverlight for Windows Embedded Application Template.
In Solution Explorer, expand the OS design project node, and then right-click Subprojects as shown in the following image.
Do one of the following:
- Click Add New Subproject if you want to create a new subproject for an application that will run on your OS, and complete the following steps.
In the Subproject Wizard that appears, on the Select name, location and template page, select an application template, enter a subproject name, and provide a location to save the auto-generated subproject files to.
For example, the following image shows a new WCE Application being created that is named MyNewSubproject. A WCE application is an application with a UI.
Click Next.
On the Auto-generated subproject files page, select how much code you want generated for you.
Tip
Do not select the Empty project option unless you want to start out without any source files.
Click Finish.
- Click Add Existing Subproject if you already have an application project that you want to add to your OS design or if you have a project template that was converted from an Expression Blend project. Then complete the following steps.
- In the Open dialog box, select the project file (such as a VCPROJ file, an SLN file, or a PBPXML file) for the project that you want to add.
For example, the following image shows a selected PBPXML file for a project template that was converted from an Expression Blend project.
- Click Open.
- In the Open dialog box, select the project file (such as a VCPROJ file, an SLN file, or a PBPXML file) for the project that you want to add.
The subproject that you add, either as a new or existing project, appears in Solution Explorer under Subprojects. The following image shows the OS design project after a new subproject was created (MyNewSubproject) and after a converted Expression Blend project was added (SWESimpleStyles).
- Click Add New Subproject if you want to create a new subproject for an application that will run on your OS, and complete the following steps.
If you plan to debug your application, do the following:
- Configure your OS design to build the debug version of the OS. In the Configuration Manager, set the Active solution configuration to the Debug configuration.
- Configure your OS design to Enable KITL. Open the Property Pages for the OS design project (not the solution), expand Configuration Properties, select Build Options, and then change Enable KITL to Yes.
- Configure your application subproject to be excluded from the OS image and to always debug. In the Property Pages for the OS design project, expand Configuration Properties, select Subproject Image Settings, and then edit the properties for each project.
The following image shows the property pages for an OS design project. There are two subprojects, both of which are configured to be excluded from the OS image and configured to build debug versions of the applications.
Warning
By default, an application subproject is configured to be included in the OS image, but it is not a part of the OS image until the next time you rebuild your OS design and OS image. If an application is included in the OS image, every change that you make to your application will require you to rebuild the OS design project and OS image before downloading the image and testing your application. If you want to download the OS image only once and keep a live connection to it from Visual Studio, then you can exclude your subproject from the OS image and just rebuild and restart your application when you want to test a change.
- Configure your OS design to build the debug version of the OS. In the Configuration Manager, set the Active solution configuration to the Debug configuration.
To build only the application (and not the entire OS design project), right-click your subproject name and click Build.
Next Steps
You can now develop your application by adding code to the source file, creating new source files, and so on.
To test your application, you must use the device or virtual CEPC for which the OS was designed. Make a connection to your device or virtual CEPC, download the OS image, and then on the Target menu in Visual Studio, click Run Programs to start your application.
Important
The device or virtual CEPC on which you test your application must not contain a stand-alone OS image. You don't need a stand-alone OS image because you have the OS design project open in Visual Studio, which you can use to download the OS image to the device or virtual CEPC before testing your application. Also, you will not be able to test your application on a stand-alone virtual CEPC if you're starting the application from within an OS design project.
For information about how to create a virtual CEPC and download an OS, see Set Up a Virtual Device and Download the OS to the Device. For more information about how to create a virtual CEPC, see Create and Run a Virtual CEPC.
For information about debugging your application, see Debug the Application.