Jaa


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 as described in this section:

  • 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 do one of the following:

    • Import the .NET Framework assembly into the Dynamics NAV database,

      You import the assembly into the table 2000000069 Add-ins. The .NET Framework assembly will be automatically deployed on the client computer when an operation from the client requires it. The assembly will be 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.

      For more information, see To import a .NET Framework assembly into the database.

      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.

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

      Similar to importing the .NET Framework assembly into the database, 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.

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

    • 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 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\110\RoleTailored Client\Add-ins or C:\Program Files (x86)\Microsoft Dynamics NAV\100\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 as described in this section:

  • 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\110\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 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\110\RoleTailored Client\Add-ins or C:\Program Files (x86)\Microsoft Dynamics NAV\100\RoleTailored Client\Add-ins.

To import a .NET Framework assembly into the database

  1. Get the public key token for the .NET Framework assembly.

    The public key token is a 16-character key that is given to the assembly when it is built and signed in Microsoft Visual Studio. To determine the public token key, run the Microsoft .NET Strong Name Utility (sn.exe) on the assembly. For more information, see How to: Determine the Public Key Token of the Windows Client Control Add-in and .NET Framework Assembly and Strong-Named Signing.

  2. Create a compressed (.zip type) file that contains the .NET Framework assembly in the desired folder structure.

  3. You can import the compressed (.zip) file when you register the NET Framework assembly from the Control Add-ins page in Dynamics NAV.

  4. In the Search box, enter Control Add-ins and then choose the related link.

  5. In the Control Add-ins window, choose New, and then in the Control Add-in Name column, enter the control add-in name. In the Public Key Token column, enter the public key token that you obtained earlier.

  6. Choose Import.

  7. In the Import Control Add-in Resource window, locate the.zip file, and then choose Open.

  8. Choose the OK button to close the Control Add-in page.

    For more information about registering a control add-in, see How to: Register a Windows Client Control Add-in.

Tip

You can also register the control add-in and import the files by using the New-NAVAddin cmdlet or Set-NAVAddin cmdlet from the Microsoft Dynamics NAV Administration Shell.

See Also

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