Using Synergy/DE repositories in Visual Studio

To use a Synergy/DE repository with a traditional Synergy or Synergy .NET project in Visual Studio, you can do either of the following:

create a Synergy/DE Repository project and then reference that project. A project that references a repository project will be rebuilt when the repository changes. When using this method, make sure no RPSMFIL, RPSTFIL, or RPSDAT settings will override references
to repository projects. For example, RPSMFIL and RPSTFIL (or RPSDAT) settings in synergy.ini and synuser.ini will override references to repository projects when the Synergy Runtime is used (for example, when running your Synergy program or Synergy/DE Repository). See Precedence for environment variables and references for details.

use RPSMFIL and RPSTFIL (or RPSDAT) to specify the location of repository files. The project will not be rebuilt when the repository changes, but you can create a pre-build event that rebuilds the repository when the project is built (see Build Events page, Project Designer).

The first method is generally best. When you add a reference or dependency to a repository project, the repository files become part of the build system, so projects that reference the repository are rebuilt if repository files change. For information on adding references and build dependencies, see Visual Studio documentation. For information on creating repository projects, see Creating a Synergy/DE Repository project below.

If your application uses multiple repositories, create Synergy/DE Repository projects for the repositories, add a reference to the primary repository, and then add build dependencies to the projects for secondary repositories (i.e., repositories specified with DBLNET2XML_RPS or DBL2XML_RPS, or a repository specified with an .INCLUDE statement).

Using repositories that don't have projects

If you use RPSMFIL and RPSTFIL (or RPSDAT) to specify the location of repository files, these environment variables should be set on the Environment Variables page or the Common Properties page of Project Designer. (It is possible to set them in a synergy.ini or synuser.ini file used by the project, but this is not recommended.) Settings on the Environment Variables and Common Properties pages are used by Visual Studio and MSBuild.

Note that settings on the Environment Variables and Common Properties pages are overridden by settings in synergy.ini and synuser.ini when the Synergy Runtime is used (e.g., when running a Synergy program or Synergy/DE Repository). Otherwise, settings on these pages override synergy.ini and synuser.ini settings (for both Visual Studio and MSBuild). For more information, see Precedence for environment variables and references.

Creating a Synergy/DE Repository project

With a Synergy/DE Repository project, you can generate the repository from a schema file, or you can use existing repository files. If you use a schema file, repository files are generated when the project is built or rebuilt (if the schema changes). Both methods use options on the Repository page of Project Designer, so see Repository page, Project Designer for more information.

Generating a repository from a schema file

To create a Visual Studio project that generates repository files from a schema file,

1.

Use the Synergy/DE Repository project template to create a Visual Studio project (select “Synergy/DE Repository” in the New Project dialog in Visual Studio).

2.

Add schema file contents to the blank schema file (repository.scm) that is automatically included in the project, or delete that schema file and add another schema file to the project. (You can have only one schema file in a repository project.) The Build Action for the schema file should be set to Compile.

3.

Go to the Repository page of the Visual Studio Project Designer. (Select the repository project node in Solution Explorer, and then select Project > Properties.)

4.

In the “RPS main file” and “RPS text file” fields, specify names (without extensions) for the repository files that will be generated for the project.

5.

If you want to generate the repository files to a location other than the default, specify that location in the Output path field.

Use the Synergy/DE Repository project template to create a Visual Studio project (select “Synergy/DE Repository” in the New Project dialog in Visual Studio).

2.

Go to the Repository page of the Visual Studio Project Designer. (Select the Repository project node in Solution Explorer, and then select Project > Properties.)

3.

Select the “Use existing repository” option on the Repository page.

4.

In the RPS main file and RPS text file fields, enter the path and names (without extensions) of the repository files you want added to the project. The repository files are copied to the project when the project is built. From that point on, the project will use its copies of these files.