Thursday, March 15, 2007

Authoring your own XP Embedded Components with Files

From the very beginning of working with XP Embedded, one of my goals was to be able to make our custom client application the "shell" for our run-time image, like this. Also, I thought it would be cool to import the .inf files from the mainboard drivers we needed to install -- the Network Adapter and the Video Adapter drivers. I had seen Mike Hall or someone at Microsoft do this by launching the File -> Import... command from Component Designer. Well, I ran through all the steps for these processes, and imported the components into the Database ( Tools -> Component Database Manager -> Click "Import .SLD" ), but when I added my new custom components I got error messages about not being able to find all of the Files associated with the component - one error message for each file.

After some experimentation, and perusing a few forums, I determined that I needed to make my own Repository for the Components I was making, and then set the Repository in the Component Details page (it is "Unknown Repository" by default). You can find detailed information on how to do this here.

I did something slight different though in order to have a single repository for all of my custom components, and have that repository listed in the Component Database Manager, as well as in the "C:\Windows Embedded Data\Repositories" directory.
  1. Create a new .sld in Component designer
  2. Right click the Repository tree node and click Add Repository
  3. Name your repository something appropriate (e.g. "MyRepo" or "ZipCo Custom Components") and set the source to a (pre-created) directory of your choice. The directory should have a text file or something in it marking it as your repository, since it will be given a long, hard to remember GUID for a directory name after step 4.
  4. Save the .sld and import it into your Component Database. Note: In the import .sld dialog make sure you have the "Copy Repository to root" checkbox checked.
Now you have your own repository in the database, and in the repositories root directory (probably "C:\Windows Embedded Data\Repositories"). Whenever you make a Custom Component of your own that has one or more files, set the Repository in the Component Details page to your custom repository (it should be listed along with the main XPe repos) and copy all of the files you use into the repositories physical folder.

PS - If you see error messages importing your .inf driver file, read this before you assume something went terribly wrong. :-)

No comments:

Disqus for A Nofsinger's Blog