Skip to content

Commit 0393b7c

Browse files
Live publish for 05 April 2024.
2 parents 55e7b66 + 7021b61 commit 0393b7c

File tree

1 file changed

+43
-39
lines changed

1 file changed

+43
-39
lines changed
Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,60 @@
11
---
22
title: Build and package plug-in code
3-
description: Learn about building plug-in code into assemblies and packages for later registration and upload to the Microsoft Dataverse service.
4-
ms.date: 03/18/2024
5-
ms.reviewer: pehecke
6-
ms.topic: article
3+
description: Learn about building and packaging plug-in code for Microsoft Dataverse, including assembly constraints and dependent assembly limitations.
4+
ms.date: 04/04/2024
5+
ms.topic: conceptual
76
author: divkamath
8-
ms.subservice: dataverse-developer
97
ms.author: dikamath
10-
search.audienceType:
8+
ms.reviewer: pehecke
9+
ms.subservice: dataverse-developer
10+
search.audienceType:
1111
- developer
1212
contributors:
1313
- phecke
1414
- JimDaly
15+
ms.custom:
16+
- ai-gen-docs-bap
17+
- ai-gen-desc
18+
- ai-seo-date:11/16/2023
19+
- bap-template
1520
---
1621

1722
# Build and package plug-in code
1823

19-
This article describes what you need to know about configuring and building an assembly for your plug-in project. We'll also discuss how to create a plug-in package that can contain your plug-in assembly plus any other require dependent assemblies your plug-in needs at run-time.
24+
This article describes constraints and limitations you need to know about when you're configuring and building an assembly for your Microsoft Dataverse plug-in.
2025

21-
## Building the plug-in assembly
26+
## Plug-in assembly constraints
2227

23-
When building a plug-in project, keep the following output assembly constraints in mind.
28+
When you build a plug-in project, keep the following output assembly constraints in mind.
2429

2530
### Use .NET Framework 4.6.2
2631

27-
Plug-in and custom workflow activity assembly projects must target .NET Framework 4.6.2. While assemblies built using later versions of the .NET Framework should generally work, if the plug-in code uses any features introduced after 4.6.2, a run-time error will occur.
28-
29-
### Optimize assembly development
32+
Plug-in and custom workflow activity assembly projects must target .NET Framework 4.6.2. Assemblies that are built using later versions of the .NET Framework should generally work. However, if the plug-in code uses any features introduced after 4.6.2, a runtime error occurs.
3033

31-
Your assembly may include multiple plug-in classes (or types) and even custom workflow activities, but can be no larger than 16 MB in size. It's recommended to consolidate plug-ins and workflow assemblies into a single assembly as long as the size remains below 16 MB.
34+
### Limit assemblies to 16 MB
3235

33-
### Signed assemblies are required
36+
Your assembly can include multiple plug-in classes or types and even custom workflow activities, but it can't be larger than 16 MB. As a best practice, we recommend that you consolidate plug-ins and workflow assemblies into a single assembly, as long as the size remains below 16 MB.
3437

35-
Assemblies must be signed before they can be registered with Dataverse only if you aren't using the [dependent assemblies](#dependent-assemblies) capability. You can use the Visual Studio **Signing** tab in your project's properties or the [Sn.exe (Strong Name Tool)](/dotnet/framework/tools/sn-exe-strong-name-tool) command to sign the assembly.
38+
### Sign assemblies before registering them
3639

37-
### Dependency on the CoreAssemblies NuGet package
40+
If you're not using the [dependent assemblies](#dependent-assemblies) capability, assemblies must be signed before you can register them with Dataverse. To sign the assembly, use the Visual Studio **Signing** tab in your project's properties or the [Sn.exe (Strong Name Tool)](/dotnet/framework/tools/sn-exe-strong-name-tool) command
3841

39-
Adding the `Microsoft.CrmSdk.CoreAssemblies` NuGet package to your project includes the required Dataverse assembly references in your project, but it doesn't upload these assemblies along with your plug-in assembly as these assemblies already exist in the server's sandbox run-time where your code executes.
42+
### NuGet CoreAssemblies are in the sandbox
4043

41-
### Where to go next
42-
43-
If you're interested in learning about or using dependent assemblies, continue reading the next section in this article. If not, proceed to [Register a plug-in](register-plug-in.md).
44+
If you add the `Microsoft.CrmSdk.CoreAssemblies` [NuGet](https://www.nuget.org) package to your project, the required Dataverse assembly references are also added, but the assemblies themselves aren't uploaded with your plug-in assembly. They already exist in the server's sandbox runtime where your code executes
4445

4546
## Dependent assemblies
4647

47-
The dependent assembly capability can be used to include other required .NET assemblies or resources (for example, localized strings) with your plug-in assembly in a single [NuGet](https://www.nuget.org) package that is uploaded to the Dataverse server during the registration process.
48-
4948
> [!IMPORTANT]
50-
> The dependent assembly capability is so important to plug-in development that you should consider using it from the start even if you do not have an immediate need to do so. Adding support for dependent assemblies to your plug-in project is much more difficult later on in the development cycle.
49+
> The dependent assembly capability is so important to plug-in development that you should consider using it from the start, even if you don't have an immediate need. Adding support for dependent assemblies to your plug-in project is much more difficult later in the development cycle.
5150
>
52-
> We do not supported use of ILMerge. This dependent assemblies feature provides a solution we can support with the same functionality as ILMerge and more.
51+
> We don't support ILMerge. The dependent assemblies capability offers the same functionality as ILMerge and more.
52+
53+
Use the dependent assembly capability to include other required .NET assemblies or resources, like localized strings, with your plug-in assembly in a single [NuGet](https://www.nuget.org) package that's uploaded to the Dataverse server during registration.
5354

54-
This NuGet package file is stored in the [PluginPackage](reference/entities/pluginpackage.md) table. The contents of the NuGet package is stored in file storage rather than the SQL database.
55+
The NuGet package file is stored in the [`PluginPackage`](reference/entities/pluginpackage.md) table. The contents of the package are stored in file storage rather than in the SQL database.
5556

56-
When you upload your NuGet package, any assemblies containing classes that implement the <xref:Microsoft.Xrm.Sdk.IPlugin> interface are registered in the [PluginAssembly](reference/entities/pluginassembly.md) table and associated with the plug-in package. As you develop and maintain your project, you continue to update the `PluginPackage` table row and changes to the related plug-in assemblies are managed on the server.
57+
When you upload your NuGet package, any assemblies that contain classes that implement the <xref:Microsoft.Xrm.Sdk.IPlugin> interface are registered in the [`PluginAssembly`](reference/entities/pluginassembly.md) table and associated with the plug-in package. As you develop and maintain your project, you continue to update the `PluginPackage` table row and changes to the related plug-in assemblies are managed on the server.
5758

5859
At runtime, Dataverse copies the contents of the NuGet package from the `PluginPackage` row and extracts it to the sandbox runtime. This way, any dependent assemblies needed for the plug-in are available.
5960

@@ -64,27 +65,26 @@ At runtime, Dataverse copies the contents of the NuGet package from the `PluginP
6465

6566
You aren't required to sign plug-in assemblies used in plug-in packages.
6667

67-
When you register individual plug-in assemblies without the dependent assemblies capability, signing is required because it provides a unique name for the assembly. But with plug-in assemblies within a plug-in package, the assemblies are loaded on the sandbox server using a different mechanism, so signing isn't necessary.
68+
When you register individual plug-in assemblies without the dependent assemblies capability, signing is required because it provides a unique name for the assembly. But with plug-in assemblies in a plug-in package, the assemblies are loaded on the sandbox server using a different mechanism, so signing isn't necessary.
6869

6970
> [!IMPORTANT]
70-
> If you sign your assemblies, be aware that signed assemblies cannot use resources contained in unsigned assemblies. If you sign your plug-in assemblies or any dependent assembly, all the assemblies that those assemblies depend on must be signed.
71+
> If you sign your assemblies, be aware that signed assemblies can't use resources that are contained in unsigned assemblies. If you sign your plug-in assemblies or any dependent assembly, all the assemblies that those assemblies depend on must be signed.
7172
>
72-
> If any signed assemblies depend on unsigned assemblies, you will get an error similar to the following: Could not load file or assembly \<AssemblyName>, Version=\<Version>, Culture=neutral, PublicKeyToken=null or one of its dependencies. A strongly-named assembly is required.
73+
> If any signed assemblies depend on unsigned assemblies, you get an error like this: "Could not load file or assembly *AssemblyName*, Version=*Version*, Culture=neutral, PublicKeyToken=null or one of its dependencies. A strongly-named assembly is required."
7374
7475
### Dependent assemblies limitations
7576

76-
The following limitations apply when using plug-in dependent assemblies.
77+
The following limitations apply when you use plug-in dependent assemblies:
7778

78-
- [Workflow extensions](workflow/workflow-extensions.md), also known as *custom workflow activities* aren't supported when using the dependent assemblies capability.
79+
- [Workflow extensions](workflow/workflow-extensions.md), also known as *custom workflow activities*, aren't supported.
7980
- On-premises environments aren't supported.
80-
- Un-managed code isn't supported. You can't include references to un-managed resources.
81+
- Unmanaged code isn't supported. You can't include references to unmanaged resources.
8182

82-
## Creating a plug-in package
83+
## Create a plug-in package
8384

84-
Your plug-in assembly plus any required dependent assemblies can be placed together in a NuGet package and then registered and uploaded to the Dataverse server. You don't need to create a package if your plug-in project doesn't require any dependent assemblies at run-time, other than what ships in the Microsoft.CrmSdk.CoreAssemblies NuGet package.
85+
You can place your plug-in assembly and any dependent assemblies together in a NuGet package, and then register and upload the package to the Dataverse server. If your plug-in project doesn't require any dependent assemblies at runtime other than what ships in the `Microsoft.CrmSdk.CoreAssemblies` NuGet package, you don't need to create a package.
8586

86-
<!-- Add correct links when available -->
87-
Instructions for creating a plug-in package using an interactive tool can be found in these separate how-to's: [Create and register a plug-in package using PAC CLI](/power-platform/developer/howto/cli-create-package), [Create and register a plug-in package using Visual Studio](/power-platform/developer/howto/vs-create-package).
87+
Learn how [create and register a plug-in package using PAC CLI](/power-platform/developer/howto/cli-create-package) and how to [create and register a plug-in package using Visual Studio](/power-platform/developer/howto/vs-create-package).
8888

8989
## All projects must be in the SDK style
9090

@@ -122,10 +122,14 @@ More information: [.NET Project SDKs](/dotnet/core/project-sdk/overview#project-
122122

123123
### Don't depend on System.Text.Json
124124

125-
Because the Microsoft.CrmSdk.CoreAssemblies NuGet package has a [dependency](https://www.nuget.org/packages/Microsoft.CrmSdk.CoreAssemblies#dependencies-body-tab) on System.Text.Json, you're able to refer to [System.Text.Json](xref:System.Text.Json) types at design time. However, the System.Text.Json.dll file in the sandbox run-time can't be guaranteed to be the same version that you reference in your project. If you need to use `System.Text.Json`, you should use the dependent assembly feature and explicitly include it in your NuGet package.
125+
Because the `Microsoft.CrmSdk.CoreAssemblies` NuGet package has a [dependency](https://www.nuget.org/packages/Microsoft.CrmSdk.CoreAssemblies#dependencies-body-tab) on [`System.Text.Json`](xref:System.Text.Json), you're able to refer to `System.Text.Json` types at design time. However, the `System.Text.Json.dll` file in the sandbox runtime might not be the same version that you refer to in your project. If you need to use `System.Text.Json`, you should use the dependent assembly capability and explicitly include it in your NuGet package.
126+
127+
## Next step
128+
129+
- [Register a plug-in](register-plug-in.md)
126130

127131
### See also
128132

129-
[Use plug-ins to extend business processes](plug-ins.md)
133+
- [Use plug-ins to extend business processes](plug-ins.md)
130134

131-
[!INCLUDE[footer-include](../../includes/footer-banner.md)]
135+
[!INCLUDE [footer-include](../../includes/footer-banner.md)]

0 commit comments

Comments
 (0)