Skip to content

12 DotNet

Gilles Querret edited this page Sep 11, 2024 · 3 revisions
  1. At this stage, you can compile code that references .NET objects, provided you have the correct assemblies.xml file. However, code completion for .NET objects is not yet available. First, we'll create the assemblies.xml file and reference it in the project.

  2. Create assemblies.xml in the current project directory:

     <?xml version="1.0" encoding="UTF-8" standalone="no"?>
     <references>
       <assembly name="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
       <assembly name="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       <assembly name="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
       <assembly name="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
       <assembly name="System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       <assembly name="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       <assembly name="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       <assembly name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       <assembly name="System.Runtime.Serialization.Formatters.Soap, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       <assembly name="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       <assembly name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
       <assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
     </references>
  3. Then add this entry openedge-project.json:

    "extraParameters": "-assemblies ."
    
  4. Restart the language server, then declare a new variable of type System.Object. This should compile correctly in your environment. However, code completion will not be available for this variable yet. To enable code completion, we need to generate the list of properties, methods, and events for .NET objects.

  5. Execute the task ABL: Generate assembly catalog. A popup window will be displayed:

  6. The expected generation time in our environment is around 30 seconds, but it can be much longer in your environment, depending on the assemblies you use. Once the process is complete, you'll see a new file named .builder/catalog.json. Ensure that this file contains several entries (it will likely be thousands of lines long).

  7. Restart the language server. You should see a message indicating Read catalog cache in 200 ms (the time may vary).

    This indicates that the JSON file has been successfully loaded by the language server. You can now use code completion on .NET objects:


Next chapter

Clone this wiki locally