Compartir a través de


How to: Add Files to a Project

If you want to include files in an application, you must add them to the project for the application. You can add existing files to a project using the Application Builder or Project Manager. New files that you create using the Project Manager are added automatically to the project. When you compile your application, Visual FoxPro includes the files for the components that are part of your the application.

Note

When you build your application from a project, files included in the project are marked as read-only. If your application includes files that are modified by the user, you must exclude these files from the build process. For more information, see Excluding Modifiable Files from Builds.

To add a file to a project

  1. Open the project for your application.

  2. In the Project Manager, expand the node in the project hierarchy containing the component type that you want to add.

  3. Click the component type you want.

  4. On the Project menu, click Add File.

    Tip

    You can also click Add in the Project Manager.

    The Select dialog box for that component type opens.

  5. In the Select dialog box, browse for and select the file you want to add, and then click OK.

For more information, see Project Manager Window.

When you reference files in a program or form, Visual FoxPro adds those files automatically to your project when you build the project, not when you reference them. For example, if a program in your project includes the following line of code, Visual FoxPro adds the file Orders.scx to your project:

DO FORM ORDERS.SCX

When you build the project, Visual FoxPro resolves references to all files and automatically includes implicit files in the project. In addition, if the files contain references to other files, building the project also resolves those references and includes those files. The referenced files appear in the Project Manager the next time you view the project.

Warning

Visual FoxPro might not be able to resolve references to picture files, such as .bmp and .msk files, depending on how they are used in code. Therefore, add pictures to your files manually. In addition, Visual FoxPro cannot automatically include files that are referenced using macro substitution because the name of the file is not known until the application runs. If your application references files using macro substitution, include the referenced files manually.

See Also

Tasks

How to: Remove Files from Projects

How to: Edit Files in Projects

Other Resources

Working with Projects