DevPartner 2018 Workshop : Maximize Your Traditional Synergy Development with Visual Studio
Exercise 2: UI Toolkit Window Library Project
This is the second of a series of exercises that demonstrate the abilities of developing Traditional Synergy inside Visual Studio.
If you have not completed the previous “Synergy/DE Repository Project creation” exercise you can find that here.
This exercise will use a standard Synergy/DE Windows Console application project to build window script files into a window library. It uses pre-build scripts to build the library.
To begin the exercise, follow these simple steps:
- Visual Studio 2017 should be running and the DevPartner2018 solution opened and active
- From the File menu select Add->New Project…
- **Note: From the File menu, please ensure you select the Add menu entry here and not the New entry!
- In the “Add New Project” dialog locate and expand the Synergy/DE entry and select the Windows entry
- Select the Console App (.NET Framework) entry
- In the Name entry field type the value WindowLibrary
- Click OK
This will create a console application. We are going to use this project to build our UI Toolkit window library so we are not really concerned with the console application it also builds. After the project is created it will open up the program.dbl default program file. Close this window.
To ensure the correct version of the software is built:
- From the Build menu, select the Configuration Manager… entry
- Under the Active solution platform prompt expand the dropdown list
- If there is an x64 entry, select
- If there is no x64 entry
- select the <New…> entry
- Under the Type or select the new platform enter the value x64
- Click the OK button
- Against the WindowLibrary entry, under the Platform column, check the value is x64. If not:
- Against the WindowLibrary 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 two window script files to the project. The files are called Maintenance.wsc and system.wsc. These window script files can be downloaded from here. Download (when prompted by the browser select “open”) and open the zip file and copy the window script files to the WindowLibrary project folder you have just created. This folder will be under the DevPartner2018 solution folder.
To add the window script files to the project follow these steps:
- Ensure that the WindowLibrary project is highlighted 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 “WindowLibrary”. If it does not, cancel the dialog and reselect the WindowLibrary project in the Solution Explorer
- Change the File extensions dropdown list from “Synergy Files” to “All Files”
- Highlight the Maintenance.wsc and system.wsc files that you placed into the folder
- Click the Add button
This will add the two script files to the project. We need to ensure that the files have been added with a Build Action of “Content”:
- Display and anchor the “Properties” window
- If the properties window is not visible, from the View menu column select the Properties Window entry
- Pin the Properties Window if it’s not already pinned
- Highlight the maintenance.wsc file in the Solution Explorer
- Validate that the Build Action is set to Content and change it if not
- Highlight the system.wsc file in the Solution Explorer
- Validate that the Build Action is set to Content and change it if not
We now need to create the pre-build script. The script is quite complex so we have provided the contents for you. You can download the script file from here. Download (when prompted by the browser select “open”) and open the zip file and copy the script file to the WindowLibrary project folder you have just created. This folder will be under the DevPartner2018 solution folder.
We can now execute this script as part of the build process. To do this we will utilize a pre-build event. To define the pre-build event:
- Ensure that the WindowLibrary project in the solution explorer is selected
- From the Project menu select the Properties entry. This may also be named WindowLibrary Properties
- At this point check that the properties page tab title includes the project name “WindowLibrary”. If it does not, close the tab and reselect the WindowLibrary project in the Solution Explorer
- In the WindowLibrary properties page select the Build Events tab
- In the Pre-build event command lines entry field enter:
"$(ProjectDir)\PreBuildScript.bat" "$(SolutionDir)" "$(ProjectDir)" %TEMP%
Now define the project dependencies
- Ensure that the WindowLibrary project in the solution explorer is selected
- From the Project menu select the Project Dependencies… entry
- Check the OnVinylRepository
- Click OK
- From the Build menu select the Rebuild Solution entry to rebuild the solution
- 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
You can check the window library has been correctly created
by opening a new File Explorer
window and navigate to the Documents\Visual Studio
2017\Projects\DevPartner2018\WinLib folder. This folder should contain
theOnVinyl_winlib.is* files.