DevPartner 2018 Workshop : Maximize You Traditional Synergy Development with Visual Studio
Exercise 3: Object and Executable Library Projects
This is the third of a series of exercises that demonstrate the abilities of developing Traditional Synergy inside Visual Studio.
If you have not completed the previous exercises you can find the first one here.
This exercise will create a Traditional Synergy Object library and add source files to it. You will then create a Traditional Synergy Executable Library project which builds from the Object library.
To begin the exercise, follow these simple steps:
- Visual Studio should be running and the DevPartner2018 solution opened and active
- From the File menu select Add->New Project…
- In the “Add New Project” dialog locate and expand the Synergy/DE entry and select the Traditional entry
- Select the Object Library (OLB) entry
- In the Name entry field type the value OnVinylObjectLibrary
- Click OK
This will create an Object Library project.; After the project is created it will open up
the Routine.dbl default program file.; Close this window.; We can also delete the default source file
from the project:
- In the OnVinylObjectLibrary project locate the Routine.dbl source file
- Right-click the Routine.dbl file and select Delete
- Delete button
To ensure the correct version of the software is built:
- From the Build menu, select the Configuration Manager… entry
- Against the OnVinylObjectLibrary entry, under the Platform column, check the value is x64.; If not:
- Against the OnVinylObjectLibrary entry, under the Platform column change the entry from Any CPU to <New…>
- For the New Platform select x64
- Uncheck the Create new solution platforms checkbox
- Click OK
- Click Close
We are going to add a number of source files to the project.; These source files can be downloaded from here.; Download (when prompted by the browser select “open”) and open the zip file and copy the source files and all folders to the OnVinylObjectLibrary project folder you have just created.; This folder will be under the DevPartner2018 solution folder.
To add the source files to the project follow these steps:
- Ensure that the OnVinylObjectLibrary project ishighlighted in the Solution Explorer
- From the Project menu select the Add Existing Item… entry
- At this point check that the dialog title includes the project name “OnVinylObjectLibrary”.; If it does not, cancel the dialog and reselect the OnVinylObjectLibrary project in the Solution Explorer
- Highlight all the source files that you placed into the folder
- **Note: Do not select the include folder
- Click the Add button
This will add the source files to the project.; To ensure we are going to build the project correctly, on the menu bar ensure that the Solution Configuration is set the Debug and the Solution Platform is set the x64.
First we need to check/change the location of the created object library:
- Ensure that the OnVinylObjectLibrary is selected in the Solution Explorer
- From the Project menu select the Properties entry
- At this point check that the tab title says “OnVinylObjectLibrary”.; If it does not, cancel the dialog and reselect the OnVinylObjectLibrary project in the Solution Explorer
- Select the Build tab
- Ensure that the Output path field reads bin\Debug\x64.; If it does not, change it
Now we can try to execute the build process.; At this point we expect the solution to fail to build and we will correct the issues:
- From the Build menu select the Rebuild Solution entry
Lots of errors, which is to be expected!
Out first task is to define where our repository structures are to be loaded from.; We need to define a reference between our Object Library and our Repository.; To define the project reference:
- Ensure that the OnVinylObjectLibrary is selected in the Solution Explorer
- From the Project menu select the Add Reference… entry
- At this point check that the dialog title includes the project name “OnVinylObjectLibrary”.; If it does not, cancel the dialog and reselect the OnVinylObjectLibrary project in the Solution Explorer
- Select the Projects tab
- Check the OnVinylRepository
- Click OK
Now we can try to execute the build process:
- From the Build menu select the Rebuild Solution entry
Further errors that need to be corrected.; The code uses an environment variable called ONVINYL_INC which we need to define.; We shall use the concept of Common Properties so that all projects have access to the environment variables:
- Ensure that the OnVinylObjectLibrary is selected
in the Solution Explorer
- From the Project menu select the Properties entry
- At this point check that the tab title says “OnVinylObjectLibrary”.; If it does not, cancel the dialog and reselect the OnVinylObjectLibrary project in the Solution Explorer
- Select the Common Properties tab
- Check the Use common properties check box
- Click inside the Name column of the properties list and enter a value of ONVINYL_INC
- In the Value column enter a value of $(SolutionDir)OnVinylObjectLibrary\includes
Now we can try the build again:
- From the Build menu select the Rebuild Solution entry
If the project fails to build this is usually an indication that Visual Studio needs to be restarted.; Shutdown and restart Visual Studio and reload the DevPartner2018 solution:
- From the Build menu select the Rebuild Solution entry
- Check the Output window to ensure the solution rebuilt correctly
- If the Output window is not visible then from the View menu column select the Output entry
The next task is to create an Executable Library.; The Executable Library will be built from the
Object Library:
- From the File menu select Add->New Project…
- In the “Add New Project” dialog locate and expand the Synergy/DE entry and select the Traditional entry
- Select the Executable Library (ELB) entry
- In the Name entry field type the value OnVinylExecutableLibrary
- Click OK
This will create an Executable Library project.; After the project is created it will open up the Routine.dbl default program file.; Close this window.; We can also delete the default source file from the project:
- In the OnVinylExecutableLibrary project locate the Routine.dbl source file
- Right-click the Routine.dbl file and select Delete
- When prompted select the Delete button
To ensure the correct version of the software is built:
- Right-click the top level DevPartner2018 solution
- Select the Configuration Manager… entry
- Against the OnVinylExecutableLibrary entry, under the Platform column, check the value is x64.; If not
- Against the OnVinylExecutableLibrary entry, under the Platform column change the entry from Any CPU to <New…>
- For the New Platform select x64
- Click OK
- Click Close
To build the Executable Library from the Object Library we
simply need to reference the Object Library:
- Ensure that the OnVinylExecutableLibrary is selected in the Solution Explorer
- From the Project menu select the Add Reference… entry
- At this point check that the dialog title includes the project name “OnVinylExecutableLibrary”.; If it does not, cancel the dialog and reselect the OnVinylExecutableLibrary project in the Solution Explorer
- Select the Projects tab
- Check the OnVinylObjectLibrary
- Click OK
The final task is to define the logical that will be used by
the runtime to locate the executable library when linked to a mainline program:
- Ensure that the OnVinylExecutableLibrary is selected in the Solution Explorer
- From the Project menu select the Properties entry
- Select the Common Properties tab
- Click inside the Name column of the properties list and enter a value of ONVINYL_EXE
- In the Value column enter a value of $(SolutionDir)$(Configuration)\$(Platform)
- Select the Build tab
- Locate the Output path: entry and enter a value of ONVINYL_EXE:
- **Note, please remember to include the “:”
- From the Build menu select the Rebuild Solutionentry
Check both the Error and Output windows: we have introduced a number of new errors.; To correct these we need to add an additional reference so that the build system can find the core UI Toolkit library:
- Ensure that the OnVinylExecutableLibrary is selected in the Solution Explorer
- From the Project menu select the Add Reference… entry
At this point check that the dialog title includes the project name “OnVinylExecutableLibrary”.; If it does not, cancel the dialog and reselect the OnVinylExecutableLibrary project in the Solution Explorer
- Ensure the Synergy tab is selected
- Select and check the tklib.elb entry
- Click OK
- From the Build menu select the Rebuild Solution entry
The project should now build successfully