DevPartner 2018 Workshop : Maximize Your Traditional Synergy Development with Visual Studio
Exercise 4: Mainline Program Projects
This is the fourth 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 mainline project and add source files to it. From this you will link to the existing libraries to build the mainline executables. Throughout the exercise you will make changes to elements of the Visual Studio solution and see the powerful MSBUILD sub-system in action.
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 Multiple Mainline (DBR) entry
- In the Name entry field type the value OnVinylTKMaint
- Click OK
This will create a multiple mainline project. After the project is created it will open up the Program1.dbl and Program2.dbl files. Close these windows. We can also delete the default source file from the project:
- In the OnVinylTKMaint project locate the Program1.dbl source file
- Right-click the Program1.dbl file and select Delete
- When prompted select the Delete button
- In the OnVinylTKMaint project locate the Program2.dbl source file
- Right-click the Program2.dbl file and select Delete
- When prompted select the Delete button
To ensure the correct version of the software is built:
- From the Build menu, select the Configuration Manager
entry
- Against the OnVinylTKMaint entry, under the Platform column, check the value is x64. If not:
- Against the OnVinylTKMaint 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 single source files to the project. This source file can be downloaded from here. Download (when prompted by the browser select open) and open the zip file and copy the source file to the OnVinylTKMaint project folder you have just created. This folder will be under the DevPartner2018 solution folder.
To add the source file to the project follow these steps:
- Ensure that the OnVinylTKMaint 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 OnVinylTKMaint. If it does not, cancel the dialog and reselect the OnVinylTKMaint project in the Solution Explorer
- Highlight the Program.dbl source file that you placed into the 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.
Now we can try to execute the build process:
- From the Build menu select the Rebuild Solution entry
Several linker errors, which is to be expected!
Out first task is to define where our application routines exist. We need to define a reference between our Mainline Project and our Executable Library project. To define the project reference:
- Ensure that the OnVinylTKMaint 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 OnVinylTKMaint. If it does not, cancel the dialog and reselect the OnVinylTKMaint project in the Solution Explorer
- Select the Projects tab
- Check the OnVinylExecutableLibrary
- Click OK
Now we can try to execute the build process:
- From the Build menu select the Rebuild Solution entry
The program fails to build because the library name is too long. We need to address this issue:
- Ensure that the OnVinylExecutableLibrary project is highlighted in the Solution Explorer
- From the Project menu select the Properties entry
- At this point check that the tab page title includes the project name OnVinylExecutableLibrary. If it does not, close the page and reselect the OnVinylExecutableLibrary project in the Solution Explorer
- Select the Application tab
- Change the Output name to OnVinylELB
Now we can try to execute the build process:
- From the Build menu select the Rebuild Solution entry
Now we can try to execute the target program. To do this we need to tell visual studio what we want to run:
- Ensure that the OnVinylTKMaint project is highlighted in the Solution Explorer
- Right-click the OnVinylTKMaint project and select Set as StartUp Project. This will bold the project name in the solution explorer
- Right-click the Program.dbl file under the OnVinylTKMaint project and select Set as Startup Object
From the Debug menu, select the Start Debugging entry to run the program.
The solution should correctly build and the program execute. Does not look great! Selecting an item from the list displays the input form, but no prompt information and there will be no field validation. Close the Vinyl Maintenance program.
We should first define the project dependencies
- Ensure that the OnVinylTKMaint project in the solution explorer is selected
- From the Project menu select the Project Dependencies
entry
- Check the WindowLibrary
- Click OK
The next task is to define additional attributes in the repository schema file. We are going to edit the schema file directly and once completed the repository project will automatically build.
- Under the OnVinylRepository project select and double click to edit the repository.scm file
- Scroll down the file in the edit window until you see the CODE field under the COUNTRY structure definition. After the existing Description attribute add the following attributes
- Prompt "Country"
- Info Line "Unique country code"
- Uppercase
- Required
- Locate the NAME field and add the following attributes after any existing attributes
- Prompt "Country name"
- Info Line "Full country name"
- Scroll down the file in the edit window until you see the CODE field under the SHOP structure definition. After the existing Description attribute add the following attributes
- Prompt "Shop code"
- Info Line "Unique shop ID"
- Uppercase
- Required
- Under the NAME field, add the following attributes after any existing attributes
- Prompt "Shop name"
- Info Line "Full shop name"
- Moving to the ADDRESS_1 field and add the following attributes after anyexisting attributes
- Prompt "Address"
- Info Line "Address line (required)"
- Required
- There are no changes required to the ADDRESS_2 field
- Scroll down to the ADDRESS_CITY field and add the following attributes after any existing attributes
- Prompt "City"
- Info Line "City"
- Required
- Moving to the ADDRESS_POSTCODE field add the following attributes after any existing attributes
- Prompt "Postal code"
- Info Line "Postal / Zip code"
- Uppercase
- Required
- Under the COUNTRY field add the following attributes after any existing attributes
- Prompt "Country"
- Info Line "Unique country code"
- Uppercase
- Required
- Below to the TELEPHONE field add the following attributes after any existing attributes
- Prompt "Telephone"
- Info Line "Telephone (unformatted)"
- For the LATITUDE field add the following attributes after any existing attributes
- Prompt "Latitude"
- Info Line "Latitude coordinate"
- Required
- Under the LONGITUDE field add the following attributes after any existing attributes
- Prompt "Longitude"
- Info Line "Longitude coordinate"
- Required
- Moving to the COMMENTS field add the following attributes after any existing attributes
- Prompt "Comments"
- Info Line "General comments"
- Scroll down the file in the edit window until you see the BAR_CODE field under the VINYL structure definition. After the existing Description attribute add the following attributes
- Prompt "bar code"
- Info Line "Vinyl bar code"
- Uppercase
- Required
- Moving to the ATRIST field add the following attributes after any existing attributes
- Prompt "Artist"
- Info Line "Artist / group information"
- Required
- Under the TITLE field add the following attributes after any existing attributes
- Prompt "Title"
- Info Line "Album / record title"
- Required
- For the IMAGE_URL field add the following attributes after any existing attributes
- Prompt "Image URL"
- Info Line "Image URL reference"
- Below the COST_PRICE field add the following attributes after any existing attributes
- Prompt "Cost"
- Info Line "Purchase price"
- Finally to the SHOP_CODE field add the following attributes after any existing attributes
- Prompt "Shop code"
- Info Line "Unique shop ID"
- Uppercase
- Required
Now we can try to execute the build process and run the target executable:
- From the Debug menu select the Start Debugging entry
Selecting an item from the list now and the input form displays prompt information and the field validation defined in the repository is now enabled in the form.
The UI is still not complete as the list and input forms dont have titles.
- Under the WindowLibrary project select and double click to edit the Maintenance.wsc file
- Scroll down the file in the edit window until you see the .input vinyllistinp declaration. Under this line add the following
- .title "Vinyl collection"
- Scroll down the file in the edit window until you see the .input vinyllistinp declaration. Under this line add the following
Now we can try to execute the build process and run the target executable:
- From the Debug menu select the Start Debugging entry
The collection list now has a title. Selecting an item from the list and the input form has a title. The window library was built as part of the request to run the target program.
If you want to compare results, you can review the finished product here.