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:

The first method is generally best (i.e., create a Synergy/DE Repository project and add a reference to it). 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).

A reference to a repository project overrides RPSMFIL and RPSTFIL (or RPSDAT) settings on the Environment Variables page or the Common Properties page of Project Designer, and they override settings in synergy.ini and synuser.ini unless the Synergy Runtime is used (for example, when running your Synergy program or Synergy/DE Repository). For more information on precedence for settings and references, see Precedence.

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 on precedence for these settings, see Precedence.

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.

Using existing repository files

To create a Visual Studio project that uses existing repository files,

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. 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.