Thank you for your interest in contributing to XrmSync! This document provides guidelines and instructions for contributing to the project.
- Getting Started
- Development Setup
- Building and Testing
- Making Changes
- Submitting Contributions
- Code Conventions
- Project Architecture
XrmSync is a .NET 8 command-line tool for synchronizing Microsoft Dataverse plugins, custom APIs, and webresources. Before contributing, familiarize yourself with:
- The README.md for basic usage
- The CLAUDE.md for detailed architecture and development guidelines
- The project's GitHub Issues for open tasks
- .NET 8 SDK or later
- A code editor (Visual Studio, VS Code, or Rider recommended)
- Git for version control
git clone https://github.com/delegateas/XrmSync.git
cd XrmSyncdotnet build# Run all tests
dotnet test
# Run sample analyzer tests
./scripts/Test-Samples.ps1 -SkipBuild
# Run tests with verbose output
./scripts/Test-Samples.ps1 -Verbose -OutputNormalizedJson# Plugin sync example
dotnet run --project XrmSync -- plugins --assembly "path/to/plugin.dll" --solution-name "MySolution"
# Webresource sync example
dotnet run --project XrmSync -- webresources --folder "path/to/webresources" --solution-name "MySolution"
# Plugin analysis example
dotnet run --project XrmSync -- analyze --assembly "path/to/plugin.dll" --pretty-print# Standard build
dotnet build
# Release build
dotnet build -c Release
# Package for NuGet
dotnet pack XrmSync/XrmSync.csproj- All new features should include unit tests
- Tests use NSubstitute for mocking
- Follow the AAA pattern (Arrange, Act, Assert)
- Sample projects in
Samples/validate different plugin frameworks - Ensure all tests pass before submitting a PR
To test the tool as an installed global tool:
dotnet tool install --global --add-source ./XrmSync/nupkg XrmSync- Check existing issues to avoid duplicate work
- For major changes, open an issue first to discuss the approach
- Fork the repository and create a feature branch from
main
Use descriptive branch names:
feature/add-custom-api-validationfix/webresource-sync-errorrefactor/improve-plugin-analyzer
Write clear, descriptive commit messages:
- Use the imperative mood ("Add feature" not "Added feature")
- Start with a capital letter
- Keep the first line under 50 characters
- Add detailed description in the body if needed
Examples:
ADD: Validate webresource dependencies before removal
FIX: Improve output when failing due to webresource dependencies
REFACTOR: Move validation to Validation namespace
- Update your fork: Sync with the latest
mainbranch - Create a feature branch: Branch from
main - Make your changes: Follow code conventions and add tests
- Test thoroughly: Run all tests and verify your changes
- Update documentation: Update README.md, CLAUDE.md, or XML docs as needed
- Submit a PR: Open a pull request with a clear description
- Provide a clear title and description
- Reference related issues (e.g., "Fixes #123" or "Relates to #456")
- Ensure all tests pass
- Keep PRs focused on a single feature or fix
- Be responsive to review feedback
## Description
Brief description of changes
## Motivation
Why is this change needed?
## Changes Made
- Change 1
- Change 2
## Testing
How was this tested?
## Related Issues
Fixes #123- Follow standard C# coding conventions
- Use meaningful variable and method names
- Keep methods focused and single-purpose
- Add XML documentation comments for public APIs
- Use
ILogger<T>for logging
- Use
InternalsVisibleToto expose internals to test projects - Implement validation rules via
IValidationRule<T> - Follow the existing patterns for analyzers and readers/writers
- Commands should implement
IXrmSyncCommandand extendXrmSyncCommandBase
- Keep business logic in
SyncService - Place data access code in
Dataverseproject - Shared models belong in
Modelproject - CLI-specific code stays in
XrmSyncproject
- XrmSync: CLI entry point and command definitions
- SyncService: Core synchronization business logic
- AssemblyAnalyzer: Reflection-based assembly analysis
- Dataverse: Data access layer for Dataverse SDK
- Model: Shared domain models and DTOs
- Create a command class implementing
IXrmSyncCommand - Define options using
System.CommandLine.Option<T> - Implement execution logic with DI container
- Register in
Program.csviaCommandLineBuilder
- Create class implementing
IValidationRule<TEntity>inSyncService/PluginValidator/Rules - Implement
Validatemethod - Throw
ValidationExceptionon rule violation - Rule is auto-discovered via DI
- Create analyzer implementing
IAnalyzer<PluginDefinition> - Implement attribute recognition in
AnalyzeTypes - Register via DI in
ServiceCollectionExtensions - Add sample project for testing
- Open an issue for bugs or feature requests
- Check the CLAUDE.md for detailed architecture documentation
- Review existing issues and PRs for similar discussions
By contributing to XrmSync, you agree that your contributions will be licensed under the same license as the project.
Thank you for contributing to XrmSync!