Share via


How to: Set .NET Framework Types to Run on the Microsoft Dynamics NAV Windows Client or Microsoft Dynamics NAV Server Computers

This topic describes how to set .NET Framework objects that are instantiated by DotNet variables to target either the Microsoft Dynamics NAV Windows client or Microsoft Dynamics NAV Server. By default, a type is set to target Microsoft Dynamics NAV Server. However, you can set the type to target the Microsoft Dynamics NAV Windows client.

For more information, see Setting .NET Framework Types to Target the Microsoft Dynamics NAV Windows Client or Server

Setting the .NET Framework Type to Target the Microsoft Dynamics NAV Windows Client

To set a .NET Framework type instance to target the Microsoft Dynamics NAV Windows client, you must complete the following tasks:

  • Set the DotNet variable for the .NET Framework type to target the Microsoft Dynamics NAV Windows client.

  • Unless the NET Framework assembly is included in the global assembly cache, you must either copy the assembly to the computer that is running the Microsoft Dynamics NAV Server or to the computers that are running the Microsoft Dynamics NAV Windows client.

    • If you copy a .NET Framework assembly on computer that is running the Microsoft Dynamics NAV Server, then Microsoft Dynamics NAV Server automatically deploys the assembly on the client computer when an operation from the client requires the .NET Framework assembly. The assembly is deployed to the %TEMP%\Microsoft Dynamics NAV\Add-Ins folder of the user who is running the client. The deployed assembly will be then be used whenever it is required by the client. If a .NET Framework assembly is updated and its version number changes, Microsoft Dynamics NAV Server will deploy the updated assembly to the client computer the next time that the client requests the assembly. The updated assembly is put in a subfolder of the %TEMP%\Microsoft Dynamics NAV\Add-Ins folder, where the subfolder has the assembly's version number as its name.

      Note

      To be deployed, an assembly must comply with the following Microsoft Dynamics NAV Server configuration settings: Chunk Size, Max Upload Size, and Prohibited File Types. For more information about these settings, see Configuring Microsoft Dynamics NAV Server.

      For more information, see To copy a .NET Framework assembly to the computer that is running Microsoft Dynamics NAV Server.

    • If you do not copy the assembly on the computer that is running the Microsoft Dynamics NAV Server, then you must copy the assembly to each computer that is running the Microsoft Dynamics NAV Windows client.

      For more information, see To copy a .NET Framework assembly to a computer that is running the Microsoft Dynamics NAV Windows client.

Important

For the Microsoft Dynamics NAV Web client, you cannot implement Microsoft .NET Framework interoperability objects that target the client.

To set the .NET Framework type to target the Microsoft Dynamics NAV Windows client

  1. In Object Designer, open the C/AL code of the Microsoft Dynamics NAV object that uses .NET Framework interoperability.

  2. Do one of the following steps:

    • For a global variable, on the View menu, choose C/AL Globals.

    • For a local variable, select the trigger that uses the variable, and then on the View menu, choose C/AL Locals.

  3. On the Variables tab, select the DotNet variable, and then on the View menu, choose Properties.

  4. In the Properties window, set the RunOnClient property to Yes.

To copy a .NET Framework assembly to a computer that is running the Microsoft Dynamics NAV Windows client

  • On the computer that is running the Microsoft Dynamics NAV Windows client, copy the.NET Framework assembly to the Add-ins folder of the Microsoft Dynamics NAV Windows client installation.

    By default, the path of this folder is C:\Program Files\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins or C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins.

    Note

    You can also put assemblies in a subfolder of the Add-ins folder. This can be useful when you have multiple versions of the same assemblies and dependencies.

Setting the .NET Framework Type to Target Microsoft Dynamics NAV Server

To set a .NET Framework type instance to target Microsoft Dynamics NAV Server, you must complete the following tasks:

  • Set the variable for the NET Framework type to target Microsoft Dynamics NAV Server.

  • Copy the .NET Framework assembly to the computer that is running Microsoft Dynamics NAV Server.

    Note

    If the assembly is included in the global assembly cache of the computer that is running Microsoft Dynamics NAV Server, then you do not have to do this task.

To set the .NET Framework type to target Microsoft Dynamics NAV Server

  1. In the development environment, in Object Designer, open the object that uses the .NET Framework variable.

  2. Do one of the following steps:

    • For a global variable, on the View menu, choose C/AL Globals.

    • For a local variable, in the C/AL Editor, select the trigger that uses the DotNet variable, and then on the View menu, choose C/AL Locals.

  3. On the Variables tab, select the NET Framework variable type, and then on the View menu, choose Properties.

  4. In the Properties window, set the RunOnClient property to No.

To copy a .NET Framework assembly to the computer that is running Microsoft Dynamics NAV Server

  • On the computer that is running Microsoft Dynamics NAV Server, copy the.NET Framework assembly to the Add-ins folder of the Microsoft Dynamics NAV Server installation folder.

    By default, the path of the Microsoft Dynamics NAV Server installation folder is C:\Program Files\Microsoft Dynamics NAV\80\Service\Add-ins.

    You can also put assemblies in a subfolder of the Add-ins folder. This can be useful when you have multiple assemblies and dependencies.

    Note

    If you are working in the development environment, to compile and test Microsoft Dynamics NAV objects, you must also copy the assembly to the Add-ins folder of the Microsoft Dynamics NAV Windows client installation on the computer that is running the development environment. By default, the path of this folder is C:\Program Files\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins or C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins.

See Also

Tasks

How to: Call .NET Framework Types From C/AL Code

Concepts

Calling .NET Framework Members from C/AL