XrmSync 1.0.0-preview.9
See the version list below for details.
dotnet tool install --global XrmSync --version 1.0.0-preview.9
dotnet new tool-manifest
dotnet tool install --local XrmSync --version 1.0.0-preview.9
#tool dotnet:?package=XrmSync&version=1.0.0-preview.9&prerelease
nuke :add-package XrmSync --version 1.0.0-preview.9
XrmSync
A command-line tool for synchronizing Dataverse plugins and custom APIs with your local plugin assemblies.
Overview
XrmSync is a powerful tool that helps you manage and synchronize your Microsoft Dataverse plugins and custom APIs. It analyzes your plugin assemblies, compares them with what's deployed in Dataverse, and performs the necessary create, update, or delete operations to keep them in sync.
Features
- Plugin Assembly Analysis: Automatically analyzes .NET assemblies to discover plugin types, steps, and images
- Intelligent Synchronization: Compares local assembly definitions with Dataverse and performs only necessary changes
- Custom API Support: Handles custom API definitions, request parameters, and response properties
- Dry Run Mode: Preview changes without actually modifying your Dataverse environment
- Solution-aware: Deploys plugins to specific Dataverse solutions
- Flexible Connection: Supports connection string and URL-based Dataverse connections
- Configuration Files: Support for JSON configuration files to streamline repetitive operations
- Comprehensive Logging: Configurable logging levels for debugging and monitoring
Installation
As a .NET Tool
dotnet tool install --global XrmSync
From Source
- Clone the repository:
git clone https://github.com/delegateas/XrmSync.git
cd XrmSync
- Build and pack the project:
dotnet build
dotnet pack XrmSync/XrmSync.csproj
- Install as a local tool:
dotnet tool install --global --add-source ./XrmSync/nupkg XrmSync
Usage
Basic Sync Command
xrmsync --assembly "path/to/your/plugin.dll" --solution-name "YourSolutionName"
Configuration File Usage
For repeated operations or complex configurations, you can read the configuration from the appsettings.json file:
xrmsync
You can also override specific options when using a configuration file:
xrmsync --dry-run --log-level Debug
Command Line Options
Sync Command
| Option | Short | Description | Required |
|---|---|---|---|
--assembly |
-a |
Path to the plugin assembly (*.dll) | Yes* |
--solution-name |
-n |
Name of the target Dataverse solution | Yes* |
--dry-run |
Perform a dry run without making changes | No | |
--log-level |
-l |
Set the minimum log level (Trace, Debug, Information, Warning, Error, Critical) | No |
--save-config |
--sc |
Save current CLI options to appsettings.json | No |
--save-config-to |
If --save-config is specified, override the filename to save to |
No |
*Required when not present in appsettings.json
Analyze Command
| Option | Short | Description | Required |
|---|---|---|---|
--assembly |
-a |
Path to the plugin assembly (*.dll) | Yes* |
--prefix |
-p |
Publisher prefix for unique names | No (Default: "new") |
--pretty-print |
--pp |
Pretty print the JSON output | No |
--save-config |
--sc |
Save current CLI options to appsettings.json | No |
--save-config-to |
If --save-config is specified, override the filename to save to |
No |
*Required when not present in appsettings.json
Assembly Analysis
You can analyze an assembly without connecting to Dataverse:
xrmsync analyze --assembly "path/to/your/plugin.dll" --pretty-print
You can also save analysis configurations:
xrmsync analyze --assembly "path/to/your/plugin.dll" --prefix "contoso" --pretty-print --save-config
This outputs JSON information about the plugin types, steps, and images found in the assembly.
Configuration File Format
XrmSync supports JSON configuration files that contain all the necessary settings for synchronization and analysis. This is particularly useful for CI/CD pipelines or when you have consistent settings across multiple runs.
The configuration uses a hierarchical structure under the XrmSync section, separating sync and analysis options under Plugin.Sync and Plugin.Analysis respectively.
Generating Configuration Files
You can automatically generate configuration files using the --save-config option with any command:
Save sync options to appsettings.json (default)
xrmsync --assembly "MyPlugin.dll" --solution-name "MyCustomSolution" --save-config
Save analysis options to appsettings.json
xrmsync analyze --assembly "MyPlugin.dll" --prefix "contoso" --pretty-print --save-config
Save to a custom file
xrmsync --assembly "MyPlugin.dll" --solution-name "MyCustomSolution" --save-config --save-config-to "my-project.json"
When using --save-config, XrmSync will:
- Take all the provided CLI options
- Create or update the target configuration file
- Merge with existing content if the file already exists
- Save the configuration in the proper JSON format
JSON Schema
{
"XrmSync": {
"Plugin": {
"Sync": {
"AssemblyPath": "path/to/your/plugin.dll",
"SolutionName": "YourSolutionName",
"DryRun": false,
"LogLevel": "Information"
},
"Analysis": {
"AssemblyPath": "path/to/your/plugin.dll",
"PublisherPrefix": "contoso",
"PrettyPrint": true
}
}
}
}
Sync Properties
| Property | Type | Description | Default |
|---|---|---|---|
AssemblyPath |
string | Path to the plugin assembly (*.dll) | Required |
SolutionName |
string | Name of the target Dataverse solution | Required |
DryRun |
boolean | Perform a dry run without making changes | false |
LogLevel |
string | Log level (Trace, Debug, Information, Warning, Error, Critical) | "Information" |
Analysis Properties
| Property | Type | Description | Default |
|---|---|---|---|
AssemblyPath |
string | Path to the plugin assembly (*.dll) | Required |
PublisherPrefix |
string | Publisher prefix for unique names | "new" |
PrettyPrint |
boolean | Pretty print the JSON output | false |
Example Configuration Files
Basic sync configuration:
{
"XrmSync": {
"Plugin": {
"Sync": {
"AssemblyPath": "MyPlugin.dll",
"SolutionName": "MyCustomSolution"
}
}
}
}
Full configuration with both sync and analysis:
{
"XrmSync": {
"Plugin": {
"Sync": {
"AssemblyPath": "bin/Release/net462/MyPlugin.dll",
"SolutionName": "MyCustomSolution",
"DryRun": true,
"LogLevel": "Debug"
},
"Analysis": {
"AssemblyPath": "bin/Release/net462/MyPlugin.dll",
"PublisherPrefix": "contoso",
"PrettyPrint": true
}
}
}
}
Analysis-only configuration:
{
"XrmSync": {
"Plugin": {
"Analysis": {
"AssemblyPath": "../../../bin/Debug/net462/ILMerged.SamplePlugins.dll",
"PublisherPrefix": "contoso",
"PrettyPrint": false
}
}
}
}
Examples
Basic synchronization:
xrmsync --assembly "MyPlugin.dll" --solution-name "MyCustomSolution"
Using a configuration file:
xrmsync
Configuration file with CLI overrides:
xrmsync --dry-run --log-level Debug
Dry run with debug logging:
xrmsync --assembly "MyPlugin.dll" --solution-name "MyCustomSolution" --dry-run --log-level Debug
Configuration
Dataverse Connection
XrmSync utilizes the Dataverse Connection NuGet package to manage connections to your Dataverse environment. See the Dataverse Connection documentation for more details on how to configure connections.
Option Priority
When using configuration files with CLI options, the following priority order applies:
- CLI arguments (highest priority) - Override everything
- Configuration file values - Used when CLI arguments are not provided
- Default values (lowest priority) - Used when neither CLI nor config file specify a value
Logging
Configure logging levels using the --log-level option:
Trace: Most detailed loggingDebug: Detailed information for debuggingInformation: General information (default)Warning: Warning messages onlyError: Error messages onlyCritical: Critical errors only
Project Structure
The solution consists of several projects:
- XrmSync: Main command-line application
- SyncService: Core synchronization logic and services
- Dataverse: Dataverse connection and data access layer
- AssemblyAnalyzer: Assembly analysis and reflection utilities
- Model: Shared data models and entities
How It Works
Assembly Analysis: The tool analyzes your plugin assembly to discover:
- Plugin types and their attributes
- Plugin steps (event handlers)
- Plugin images (entity snapshots)
- Custom API definitions
Dataverse Comparison: It connects to your Dataverse environment and compares:
- Existing plugin assemblies and their metadata
- Current plugin registrations
- Custom API configurations
Synchronization: Based on the comparison, it performs:
- Creates new plugin types and steps
- Updates existing configurations
- Removes obsolete registrations
- Manages custom API definitions
Development
Prerequisites
- .NET 8 SDK
- Visual Studio 2022 or VS Code
- Access to a Dataverse environment for testing
Building
dotnet build
Testing
dotnet test
./scripts/Test-Samples.ps1 -SkipBuild
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This project is licensed under the MIT License. See the LICENSE file for details.
Support
For issues, questions, or contributions, please visit the GitHub repository.
Copyright (c) 2025 Context& A/S
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 45 | 10/9/2026 |
| 1.0.0-preview.27 | 86 | 9/30/2026 |
| 1.0.0-preview.26 | 65 | 9/30/2026 |
| 1.0.0-preview.25 | 210 | 8/17/2026 |
| 1.0.0-preview.24 | 105 | 8/6/2026 |
| 1.0.0-preview.23 | 98 | 8/6/2026 |
| 1.0.0-preview.22 | 82 | 8/5/2026 |
| 1.0.0-preview.21 | 118 | 6/29/2026 |
| 1.0.0-preview.20 | 95 | 6/26/2026 |
| 1.0.0-preview.19 | 1,764 | 4/24/2026 |
| 1.0.0-preview.18 | 109 | 4/22/2026 |
| 1.0.0-preview.17 | 97 | 4/20/2026 |
| 1.0.0-preview.16 | 120 | 3/2/2026 |
| 1.0.0-preview.15 | 99 | 2/27/2026 |
| 1.0.0-preview.14 | 1,640 | 11/18/2025 |
| 1.0.0-preview.13 | 377 | 11/5/2025 |
| 1.0.0-preview.12 | 209 | 11/5/2025 |
| 1.0.0-preview.11 | 214 | 11/5/2025 |
| 1.0.0-preview.10 | 370 | 10/8/2025 |
| 1.0.0-preview.9 | 186 | 10/3/2025 |