Struggling to run the examples

Hi,

I am working with Aspose.Words and Outsystems to get the aspose functionality into Outsystems.

I downloaded the examples with the github plugin in visual studio 2022, but I am at a loss for how to run the examples.

I am most interested in the ExReportingEngine.cs in the ApiExamples solution, but when I try to run the solution I get the error “A project with an Output Type of Class Library cannot be started directly. in order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.”

Im not too familiar with C# but this seems to indicate that I can’t run this solution. Should I be looking somewhere else to run the examples or should I be building my own program to call the methods defined in the examples?

@MitchellJ

It sounds like you’re encountering an issue with running the example projects in Visual Studio, specifically with the ExReportingEngine.cs file. The error message you’re seeing indicates that the project you are trying to run is set up as a Class Library, which cannot be executed directly.

To resolve this, you will need to create a separate executable project (like a Console Application) that references the Class Library project. Here are the steps you can follow:

  1. Create a New Console Application:

    • In Visual Studio, go to File > New > Project.
    • Select Console App from the list of project templates and create a new project.
  2. Add Reference to the Class Library:

    • Right-click on the newly created Console Application project in the Solution Explorer.
    • Select Add > Reference....
    • In the Reference Manager, find and check the box next to your Class Library project (the one containing ExReportingEngine.cs) and click OK.
  3. Set the Console Application as the Startup Project:

    • Right-click on the Console Application project in the Solution Explorer and select Set as StartUp Project.
  4. Call the Methods from ExReportingEngine.cs:

    • In the Main method of your Console Application, you can now create an instance of the class from ExReportingEngine.cs and call its methods.

Here’s a simple example of how you might structure your Main method:

using System;

namespace YourConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            // Assuming ExReportingEngine is the class you want to use
            var reportingEngine = new ExReportingEngine();
            reportingEngine.Run(); // Call the method you want to execute
        }
    }
}

This setup should allow you to run the examples without encountering the output type error. If you have any further questions or need additional assistance, feel free to ask!

@MitchellJ Examples in the project are create using unit tests. So you should simply find the require test in the test explorer and run it.