PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Creating a .NET assembly from a WINDEV project
  • Generating C# classes from WINDEV classes
  • Tips for optimizing the code of classes
  • Types of parameters and types of return values
  • "Input/Output" parameters
  • Consequence: an easier assembly code
  • Creating the setup program of a .NET assembly
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
Before creating a.NET assembly, you must check the configuration of the development computer.
Creating a .NET assembly from a WINDEV project
To create a .NET assembly:
  1. Open the WINDEV project from which the .NET assembly must be created.
    This project must contain all the elements required by the .NET assembly. This project can for example contain one or more global procedures and/or classes, containing various methods. These methods and/or procedures will be the entry points of the assembly.
    Note: The .NET assemblies intended to be used in other environments should be documented. This documentation is automatically generated by WINDEV.
  2. Select "Workshop .. .NET .. Generate a .NET assembly DLL".
    Note: If you did not create a project configuration specific to the creation of a .NET assembly, the wizard for creating a project configuration starts. To optimize the organization of your projects, we advise you to use the project configurations. See Project configuration for more details.
    In this case, the wizard asks for:
    Among the quick access buttons, select the generation mode "Generate a .NET assembly":

    Note: If you did not create a project configuration specific to the creation of a .NET assembly, the wizard for creating a project configuration starts. To optimize the organization of your projects, we advise you to use the project configurations. See Project configuration for more details.
    In this case, the wizard asks for:
    • the name and description of the project configuration.
    • the elements included in the project configuration.
      Then, the wizard for generating a .NET executable starts.
  3. The wizard for creating a .NET assembly starts.
  4. Specify the properties of the .NET assembly that will be created: file name, company, description, copyright, ...
    The "Advanced" button is used to define the additional properties specific to the .NET assembly.
  5. Specify the version number. Two formats are available for the version numbers:
    • Standard format. This format is the standard format managed by Windows. This format corresponds to a set of 4 numbers separated by dots.
      • The first group of 4 digits corresponds to the number of major changes performed in the application.
      • The second group of 4 digits corresponds to the number of minor changes performed in the application.
      • The third group of 4 digits corresponds to the generation number.
        We advise you to automatically increment this number at each generation. This increment operation is automatically performed if "Automatically increment the version at each generation" is checked.
      • The last group of 4 digits corresponds to the number of reviews (branches in the SCM for example).
        We advise you to automatically increment this number at each generation. This increment operation is automatically performed if "Automatically increment the version at each generation" is checked.
    • Format for compatibility. This format was used until version 12 for the WINDEV applications.
      Note: All the characters (digits and letters) are allowed. For example: "1.01A".
      If "Automatically increment the version at each generation" is checked, the version number will be modified at each generation: the version number "1.01A" will become "1.01B" and the version number "A14Z" will become "A15A".
  6. Select the different WINDEV elements (project, windows, classes, ...) that will be included in the .NET assembly.
    • The "Add" button is used to add an element into the .NET assembly: images, text files, ...
    • The "Remove" button is used to delete an element from the .NET assembly. The corresponding files and their dependencies will not be included in the.NET assembly.
    • The "WDU" button is used to display the elements found in a library that was created beforehand.
      Note: If the WINDEV project (".WDP" file) is selected:
      • the project analysis will be associated with the.NET assembly.
      • the initialization process of the project will be run when the .NET assembly is initialized.
      • the ending process of the project will be run when closing the .NET assembly.
  7. Select the WINDEV classes (".WDC" files) and sets of procedures (".WDG" file) that will be made accessible. These classes and these sets of procedures can be handled from the application that will use the .NET assembly.
    A public class of the assembly must have a constructor without parameter (or with optional parameters).
    All the classes that are instantiated in a public class of the assembly must also be public.
    Note: A .NET class is generated with the name of the set of procedures. This .NET class contains:
    • a static function corresponding to each function of the set of procedures.
    • a static member corresponding to each variable of the set of WINDEV procedures.
  8. Select the version of the .NET Framework to use as well as the WINDEV Framework (32-bit or 64-bit) that will be supplied with the .NET assembly. Select the libraries of the WINDEV Framework required for your assembly to operate.

    Notes:
    • The libraries of the WINDEV Framework corresponding to .NET (wdxxxnetx.dll for example) cannot be renamed.
    • Some project configurations must be used if the same project allows you to generate several versions of the same assembly.
    • Two .NET assemblies must be generated in WINDEV if a .NET assembly must operate in 32 bits and in 64 bits. The same assembly cannot operate in 32 bits and in 64 bits.
  9. Configure the error message if necessary. This message will be displayed if an error occurs when using the .NET assembly.
    The "Default" button allows you to configure a default error message.
  10. Select the options specific to the assembly:
    • The "Compilation options" button is used to select a specific C# compiler and to specify some additional compilation options.
    • The "Advanced properties" button is used to define whether the .NET assembly must be accessible by a program that uses the COM technology. See Create a .NET assembly accessible by COM for more details.
  11. Validate.
The .Net assembly is generated in the EXE directory of the project as well as an XML document containing the documentation about the assembly.
Notes:
  • The assemblies generated by WINDEV can be used like any other .NET assembly. However, the WINDEV framework and the assembly must be found in the same directory.
  • Limitation: The reports and the queries do no operate in the .NET assemblies.
  • The .Net assemblies generated by WINDEV have a single runtime context: therefore, they can be run by a single thread.
Generating C# classes from WINDEV classes

Tips for optimizing the code of classes

Tips for optimizing the code of the generated classes are presented below. In your WINDEV classes:
  • Type the parameters of methods and the return values.
  • Use the "LOCAL" keyword in order for the parameters of methods not to be "Input/Output" parameters.
  • Replace the reserved words of C#.
  • Eliminate the multiple inheritances.
Versions 23 and later

Types of parameters and types of return values

The available types are those of WLanguage.
If the types of parameters are not specified in the prototype of the method, they are automatically defined by WINDEV. In this case, the generator of .NET assembly is using the "Object" type.
New in version 23

Types of parameters and types of return values

The available types are those of WLanguage.
If the types of parameters are not specified in the prototype of the method, they are automatically defined by WINDEV. In this case, the generator of .NET assembly is using the "Object" type.

Types of parameters and types of return values

The available types are those of WLanguage.
If the types of parameters are not specified in the prototype of the method, they are automatically defined by WINDEV. In this case, the generator of .NET assembly is using the "Object" type.

"Input/Output" parameters

If the LOCAL keyword is not used in the parameter declaration in the function prototype, the parameter is considered in "Input/Output" (the assembly generator uses the "ref" keyword).

Consequence: an easier assembly code

When exporting a standard WLanguage class, all the parameters are non-typed and in Input/Output.
If the above-mentioned optimizations are not performed, the assembly generator generates functions that accept "ref object" parameters, which makes the program that uses the assembly more complex.
Indeed, to pass a "ref object" parameter to a function (in C# for example), you must:
  1. Create an "Object".
  2. Copy the type variable of C# into this "object".
  3. Pass by reference an "Object" in parameter to the method of the WLanguage class.
Creating the setup program of a .NET assembly
The setup program for a.NET assembly is created as any other setup program for a standard WINDEV application.
To create the setup program of a .NET assembly:
  1. Select "Workshop .. .NET .. Create the setup procedure of a .NET assembly".Among the quick access buttons, select the generation mode "Create the setup procedure of the assembly":
  2. Follow the instructions given by the wizard.
Note: The assemblies generated by WINDEV can be used like any other .NET assembly. However, the WINDEV framework and the assembly must be found in the same directory.
Related Examples:
WD Using DOTNET Training (WINDEV): WD Using DOTNET
[ + ] This example converts currencies into other currencies.
The base of this project (the cEuro class) is used to create a.Net assembly
WD Using.NET is presented:
1/ As a WINDEV project and an assembly (all working without.Net in test mode)
2/ As a.Net project written in  C# and a.Net executable
Summary of the example provided with WINDEV:
Now you can use.Net assemblies in WINDEV and you can generate.Net assemblies from WINDEV!
Minimum required version
  • Version 9
Comments
Click [Add] to post a comment