{"title":".NET control add-ins","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-dotnet-controladdins/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-dotnet-controladdins, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-dotnet-controladdins","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Description of the process of declaring the usage of a .NET or JavaScript add-ins in AL.","date":"2025-01-07","meta":{"topic":"article"},"outline":[{"level":1,"title":".NET control add-ins","slug":"net-control-add-ins","at":0,"chars":6108},{"level":2,"title":"Remarks","slug":"remarks","at":4864,"chars":533},{"level":2,"title":"Related information","slug":"related-information","at":5397,"chars":711}],"text":"# .NET control add-ins\nIn Dynamics 365 Business Central on-premises you can use existing .NET and JavaScript control add-ins from the AL Language through .NET interoperability. It's recommended that you convert your existing .NET and JavaScript add-ins to native AL control add-ins that are supported both on-premises and in the cloud. For more information about native AL control add-ins, see Control add-in object<devenv-control-addin-object>.\nTo declare the usage of a .NET or JavaScript add-in in AL, you need three critical pieces of information about the .NET type that represent the interface of the add-in. These are the name of the assembly containing the add-in, the name of the control add-in, and the name of the class that implements the control add-in. We'll show how to retrieve this information for the Microsoft.Dynamics.Nav.Client.PingPong control add-in that ships with Business Central.\nThe name of the assembly can be retrieved from the AssemblyName element in the `.csproj` file associated with the .NET project that represents the control add-in. In this case, the name of the assembly is Microsoft.Dynamics.Nav.Client.PingPong.\n> NOTE\n> If you don't have access to the `.csproj file`, you can determine the name of the assembly by following the instructions in How to: Determine an Assembly's Fully Qualified Name<https://learn.microsoft.com/dotnet/framework/app-domains/how-to-determine-assembly-fully-qualified-name>.\nThe following code sample contains the stub definition of the Microsoft.Dynamics.Nav.Client.PingPong .NET add-in.\n```csharp\nnamespace Microsoft.Dynamics.Nav.Client.PingPong\n{\n\n/// <summary>\n/// Add-in for pinging the server from the client. The client will respond with a pong.\n/// </summary>\n[ControlAddInExport(\"Microsoft.Dynamics.Nav.Client.PingPong\")]\npublic class PingPongAddIn : WinFormsControlAddInBase\n{\n\n        /// <summary>\n        /// Event will be fired when the AddIn is ready for communication through its API\n        /// </summary>\n        [ApplicationVisible]\n        public event MethodInvoker AddInReady;\n\n        /// <summary>\n        /// Event will be fired when the specified time by the ping has elapsed.\n        /// </summary>\n        [ApplicationVisible]\n        public event MethodInvoker Pong;\n\n        /// <summary>\n        /// Starts the ping process.\n        /// </summary>\n        /// <param name=\"milliseconds\">Number of milliseconds before ponging.</param>\n        /// <remarks>If a milliseconds are less than the minimum then the MinimumValue is used.</remarks>\n        [ApplicationVisible]\n        public void Ping(int milliseconds)\n        {\n            ...\n        }\n}\n\n}\n```\nThe next needed piece of information is the namespace-qualified name of the type annotated with the ControlAddInExport attribute. This is the type that provides the implementation of the control add-in and which exposes members annotated with the ApplicationVisible attribute to the AL runtime. In this example, that's Microsoft.Dynamics.Nav.Client.PingPong.PingPongAddIn.\nThe ControlAddInExport attribute's constructor takes as an argument the name of the control add-in, as represented in the runtime, and in existing C/AL code. In this example, the name of the control add-in is Microsoft.Dynamics.Nav.Client.PingPong. This was the last component needed to construct a declaration for this .NET control add-in in AL. The name of the assembly is used in creating the assembly construct, the namespace-qualified name of the type is used as the first element in the type declaration, and the name of the control add-in is used as the alias of the type. You complete the declaration by setting the IsControlAddIn property to true. This property is used to tell the AL compiler to treat the given type declaration as a .NET control add-in declaration.\nRemember to add the setting \"AL: Assembly Probing Paths\" in the User Settings or Workspace Settings specifying the path of the folder containing the assembly so that the compiler can access it. See Getting started with Microsoft .NET Interoperability from AL<devenv-get-started-call-dotnet-from-al>.\n```al\ndotnet\n{\n    assembly(\"Microsoft.Dynamics.Nav.Client.PingPong\")\n    {\n        type(\"Microsoft.Dynamics.Nav.Client.PingPong.PingPongAddIn\"; PingPongAddIn)\n        {\n            IsControlAddIn = true;\n        }\n    }\n}\n```\nYou can now use the Microsoft.Dynamics.Nav.Client.PingPong from AL, just as you use a native control add-in.\n```al\npage 50100 MyPage\n{\n    layout\n    {\n        area(Content)\n        {\n            usercontrol(PingPongControl; PingPongAddIn)\n            {\n                trigger Pong()\n                begin\n                    Message('Pong received.');\n                end;\n\n                trigger AddInReady()\n                begin\n                    Message('Ready');\n                end;\n            }\n        }\n    }\n}\n```\n## Remarks\nOnly members of the .NET type implementing the control add-in that are annotated with the ApplicationVisibleAttribute will be accessible from AL. Usages of .NET control add-ins in C/AL are automatically converted to AL by the Txt2Al conversion tool<devenv-txt2al-tool>, but the code will only compile, if you manually insert the declaration of the control add-in, as outlined above.\nIf within the same project you have a native AL control add-in and a .NET add-in with the same name, the .NET add-in will be the one used.\n## Related information\nMigrating from .NET framework to .NET standard<devenv-migrate-from-dotnet-framework-to-dotnet-standard>\nGet started with AL<devenv-get-started>\nControl add-in object<devenv-control-addin-object>\nGetting started with Microsoft .NET interoperability from AL<devenv-get-started-call-dotnet-from-al>\nSubscribing to events in a .NET framework type<devenv-dotnet-subscribe-to-events>\nSerializing .NET framework types<devenv-dotnet-serializing-dotnetframework-types>\nHow to: Determine an assembly's fully qualified name<https://learn.microsoft.com/dotnet/framework/app-domains/how-to-determine-assembly-fully-qualified-name>\nAL Language extension configuration<devenv-al-extension-configuration>"}