Set Up the SqlBookWCF Solution

Takes you through the steps required to set up the SqlBookWCF Visual Studio solution used in this tutorial.

Create the SqlBookWCF solution and project

  1. In Visual Studio, click File > New > Project.
  2. On the Create a new project dialog box, scroll down the list, and select WCF Service Library (.NET Framework), and then click Next.
  3. Complete the fields as follows:
    Project name SqlBookWCF
    Location c:\tutorials\SQL
    Solution Name SqlBookWCF
    Framework Choose the appropriate .NET Framework version from the drop-down list.
    Note: Must be version 4.7.2 or later.
  4. Check Place solution and project in the same directory.
  5. Click Create.

Add existing projects

We provide the SqlBookWrapper and SqlLegacyBook projects for you to add to the solution. These contain application source code and references.

  1. In the Solution Explorer, right-click the solution; then select Add > Existing Project.
  2. Browse to the %PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\SQL\ado.net\SqlBookWrapper directory.
  3. Double-click the SqlBookWrapper COBOL project.
  4. Again, in the Solution Explorer, right-click the solution; then select Add > Existing Project.
  5. Browse to the %PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\SQL\ado.net\SqlLegacyBook directory.
  6. Double-click the SqlLegacyBook COBOL project.

Add project references

The two projects you just added to the solution need to be incorporated by reference. Here you create a reference from the SqlBookWCF project to the SqlBookWrapper and SqlLegacyBook projects.

  1. In the Solution Explorer, right-click the SqlBookWCF project; then select Add > Reference.
  2. In the left pane, click Projects.
  3. In the right pane, check SqlBookWrapper and SqlLegacyBook; then click OK.

Replace generated components

When you created the SqlBookWCF project, it generated some default configuration and source code files. We have provided updated files to replace these:

  1. In the Solution Explorer, delete the app.config, IService1.cbl, and Service1.cbl files from the SqlBookWCF project.
  2. Right-click the project; then select Add > Existing Item.
  3. On the Add Existing Item dialog box, select All Files (*.*) from the Filename filter drop-down list.
  4. Browse to the %PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\SQL\ado.net\SqlBookDemoWCF\SqlBookWCF directory.
  5. Select the following files:
    • app.config
    • ISqlBook.cbl
    • SqlBookService.cbl
  6. Click Add.

Build the solution

  • In the Solution Explorer, right-click the SqlBookWCF solution; then select Build Solution from the context menu.