diff --git a/src/Dataverse/PDPackage/README.md b/src/Dataverse/PDPackage/README.md index b53be1c..54534d6 100644 --- a/src/Dataverse/PDPackage/README.md +++ b/src/Dataverse/PDPackage/README.md @@ -38,7 +38,7 @@ All `ProjectReference` items default to `ReferenceOutputAssembly=false` via `Ite ### ILRepack -`DataverseILRepack` (runs after `Build`) merges all non-Microsoft DLLs (excluding reference assemblies and `Newtonsoft.Json`) into the main output assembly using ILRepack.exe. Can be disabled with `DataversePackageRunILRepack=false` or `SkipPackageILRepack=true`. +`MergePackageAssemblyDependencies` (runs after `Build`) merges all non-Microsoft DLLs (excluding reference assemblies and `Newtonsoft.Json`) into the main output assembly using ILRepack.exe. Can be disabled with `true`. ### CMT package discovery @@ -70,12 +70,18 @@ All `ProjectReference` items default to `ReferenceOutputAssembly=false` via `Ite | Property | Default | Description | |----------|---------|-------------| -| `DataversePackageRunILRepack` | `true` | Runs ILRepack after build. | -| `SkipPackageILRepack` | _(none)_ | Set to `true` to skip ILRepack. | +| `TalxisSkipAssemblyMerge` | _(unset)_ | When `true`, skips the post-build `MergePackageAssemblyDependencies` ILRepack step. | | `ILRepackVersion` | `2.0.18` | ILRepack NuGet package version. | | `ILRepackExe` | `$(NuGetPackageRoot)ilrepack\$(ILRepackVersion)\tools\ILRepack.exe` | Path to ILRepack.exe. | | `ReferencedAssembliesDir` | `$(TargetDir)` | Directory scanned for assemblies to merge. | -| `DataversePackageILRepackKeyFile` | _(none)_ | Strong-name key file passed to ILRepack `/keyfile`. | +| `ILRepackKeyFile` | _(none)_ | Strong-name key file passed to ILRepack `/keyfile`. | + +### Validation + +| Property | Default | Description | +|----------|---------|-------------| +| `TalxisSkipPcfDependencyValidation` | _(unset)_ | When `true`, skips the `TalxisValidatePcfDependencies` check after publish. | +| `TalxisIgnoredPcfPrefixes` | _(unset)_ | Semicolon-separated PCF control prefixes to exclude from dependency validation. | ### CMT packages diff --git a/src/Dataverse/PDPackage/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.PdPackage.ILRepack.targets b/src/Dataverse/PDPackage/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.PdPackage.ILRepack.targets index 7481b43..6136f2a 100644 --- a/src/Dataverse/PDPackage/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.PdPackage.ILRepack.targets +++ b/src/Dataverse/PDPackage/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.PdPackage.ILRepack.targets @@ -2,15 +2,16 @@ 2.0.18 $(NuGetPackageRoot)ilrepack\$(ILRepackVersion)\tools\ILRepack.exe - true $(TargetDir) $([System.Text.RegularExpressions.Regex]::Replace('$(ReferencedAssembliesDir)', '[\\/]+$', '')) - + + $(TargetPath) - <_KeyFileSwitch Condition="Exists('$(DataversePackageILRepackKeyFile)')">/keyfile:"$(DataversePackageILRepackKeyFile)" + <_KeyFileSwitch Condition="Exists('$(ILRepackKeyFile)')">/keyfile:"$(ILRepackKeyFile)" <_ILRepackCommand Condition="$([MSBuild]::IsOSPlatform('Windows'))">"$(ILRepackExe)" <_ILRepackCommand Condition="!$([MSBuild]::IsOSPlatform('Windows'))">mono "$(ILRepackExe)" @@ -31,12 +32,19 @@ - - - + + + - + + + + diff --git a/src/Dataverse/Plugin/README.md b/src/Dataverse/Plugin/README.md index d153e96..82f5ae6 100644 --- a/src/Dataverse/Plugin/README.md +++ b/src/Dataverse/Plugin/README.md @@ -1,6 +1,6 @@ # TALXIS.DevKit.Build.Dataverse.Plugin -MSBuild integration for Dataverse plugin assembly projects. Configures Visual Studio project type GUIDs for CRM plugin development, brings in `Microsoft.CrmSdk.CoreAssemblies` and `Microsoft.PowerApps.MSBuild.Plugin`, applies automatic Git-based versioning, and exposes metadata targets that allow Solution projects to discover and integrate plugin assemblies during build. +MSBuild integration for Dataverse plugin assembly projects. Configures Visual Studio project type GUIDs for CRM plugin development, brings in `Microsoft.CrmSdk.CoreAssemblies` and `Microsoft.PowerApps.MSBuild.Plugin`, applies automatic Git-based versioning, merges referenced managed dependencies into the output DLL via ILRepack so the Dataverse sandbox can load all required types from a single assembly, and exposes metadata targets that allow Solution projects to discover and integrate plugin assemblies during build. ## Installation @@ -25,6 +25,7 @@ The package sets `ProjectType` to `Plugin` and configures `ProjectTypeGuids` for ### Build-time targets - **TalxisBeforeBuild** (runs before `BeforeBuild`) -- executes `GenerateVersionNumber` followed by `ApplyPluginVersionNumber` to set `AssemblyVersion`, `FileVersion`, `Version`, and `PackageVersion` from Git. +- **MergeAssemblyDependencies** (runs after `Build`) -- uses [ILRepack](https://github.com/gluck/il-repack) to merge every managed DLL that landed in `$(OutDir)` into the main plugin assembly, so the Dataverse sandbox (which loads a single assembly) can resolve all referenced types without sibling DLLs. Sandbox-provided assemblies are skipped: `Microsoft.Xrm.Sdk*`, `Microsoft.Crm.Sdk.Proxy`, `Newtonsoft.Json`, `System.*`, `mscorlib`, `netstandard`. Idempotent — always reads the raw compiler output from `$(IntermediateOutputPath)` so the target can safely re-run within the same Solution build. Merged types keep their original public names (`Internalize=false`) to preserve Dataverse's reflection-based plugin type detection. Disable per-project with `true`. ### Integration targets @@ -44,10 +45,11 @@ These targets are called by `TALXIS.DevKit.Build.Dataverse.Solution` when it dis | `PluginTargetFramework` | `$(TargetFramework)` or `net462` | Target framework used to locate the compiled plugin DLL. | | `PluginPublishFolderName` | `publish` | Publish folder name under `bin\\\`. | | `PluginAssemblyId` | _(auto-generated)_ | Explicit GUID for the plugin assembly metadata; a new GUID is generated if empty. | +| `TalxisSkipAssemblyMerge` | _(unset)_ | When `true`, skips the post-build `MergeAssemblyDependencies` ILRepack step. | ## Related Packages -- **Depends on**: `TALXIS.DevKit.Build.Dataverse.Tasks`, `Microsoft.PowerApps.MSBuild.Plugin`, `Microsoft.CrmSdk.CoreAssemblies` +- **Depends on**: `TALXIS.DevKit.Build.Dataverse.Tasks`, `Microsoft.PowerApps.MSBuild.Plugin`, `Microsoft.CrmSdk.CoreAssemblies`, `ILRepack.Lib.MSBuild.Task` - **Consumed by**: `TALXIS.DevKit.Build.Dataverse.Solution` projects via `ProjectReference` diff --git a/src/Dataverse/Plugin/TALXIS.DevKit.Build.Dataverse.Plugin.nuspec b/src/Dataverse/Plugin/TALXIS.DevKit.Build.Dataverse.Plugin.nuspec index 6c2dda0..e3c5b03 100644 --- a/src/Dataverse/Plugin/TALXIS.DevKit.Build.Dataverse.Plugin.nuspec +++ b/src/Dataverse/Plugin/TALXIS.DevKit.Build.Dataverse.Plugin.nuspec @@ -18,6 +18,7 @@ + diff --git a/src/Dataverse/Plugin/msbuild/tasks/DisableILRepackAutoMerge.targets b/src/Dataverse/Plugin/msbuild/tasks/DisableILRepackAutoMerge.targets new file mode 100644 index 0000000..dcf8208 --- /dev/null +++ b/src/Dataverse/Plugin/msbuild/tasks/DisableILRepackAutoMerge.targets @@ -0,0 +1,5 @@ + + + + diff --git a/src/Dataverse/Plugin/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.Plugin.props b/src/Dataverse/Plugin/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.Plugin.props index 6f64f4c..aa8390b 100644 --- a/src/Dataverse/Plugin/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.Plugin.props +++ b/src/Dataverse/Plugin/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.Plugin.props @@ -13,5 +13,6 @@ + diff --git a/src/Dataverse/Plugin/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.Plugin.targets b/src/Dataverse/Plugin/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.Plugin.targets index c02b256..6687a6d 100644 --- a/src/Dataverse/Plugin/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.Plugin.targets +++ b/src/Dataverse/Plugin/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.Plugin.targets @@ -25,6 +25,20 @@ + + + + $(MSBuildThisFileDirectory)DisableILRepackAutoMerge.targets + + + + diff --git a/src/Dataverse/Solution/README.md b/src/Dataverse/Solution/README.md index a24d907..12fb358 100644 --- a/src/Dataverse/Solution/README.md +++ b/src/Dataverse/Solution/README.md @@ -99,6 +99,11 @@ The package sets `ProjectType` to `Solution` and imports `Microsoft.PowerApps.MS ### Validation +| Property | Default | Description | +|----------|---------|-------------| +| `TalxisSkipDuplicateGuidValidation` | _(unset)_ | When `true`, skips the `TalxisValidateDuplicateGuids` check during build. | +| `TalxisSkipQuickFindValidation` | _(unset)_ | When `true`, skips the `TalxisValidateQuickFindViews` check during build. | + Schema validation via `ValidateSolutionComponentSchema` is **not wired automatically** -- invoke it manually (e.g. `dotnet build -t:ValidateSolutionComponentSchema`). No skip property is needed. ## Related Packages diff --git a/src/Dataverse/Tasks/msbuild/tasks/Targets/MergeAssemblyDependencies.targets b/src/Dataverse/Tasks/msbuild/tasks/Targets/MergeAssemblyDependencies.targets new file mode 100644 index 0000000..7a56b2b --- /dev/null +++ b/src/Dataverse/Tasks/msbuild/tasks/Targets/MergeAssemblyDependencies.targets @@ -0,0 +1,50 @@ + + + + + + + + <_TalxisMergePrimaryRaw>$(IntermediateOutputPath)$(AssemblyName).dll + <_TalxisMergeOutputDll>$(OutDir)$(AssemblyName).dll + + + <_TalxisMergeAll Include="$(OutDir)*.dll" /> + <_TalxisMergePrimary Include="@(_TalxisMergeAll)" + Condition=" '%(Filename)%(Extension)' == '$(AssemblyName).dll' " /> + <_TalxisMergeDeps Include="@(_TalxisMergeAll)" Exclude="@(_TalxisMergePrimary)" /> + + <_TalxisMergeDeps Remove="@(_TalxisMergeDeps)" + Condition=" '%(Filename)' == 'mscorlib' + Or '%(Filename)' == 'netstandard' + Or '%(Filename)' == 'Newtonsoft.Json' + Or '%(Filename)' == 'Microsoft.Xrm.Sdk' + Or $([System.String]::Copy('%(Filename)').StartsWith('Microsoft.Xrm.Sdk.')) + Or '%(Filename)' == 'Microsoft.Crm.Sdk.Proxy' + Or $([System.String]::Copy('%(Filename)').StartsWith('System.')) " /> + + + + + + + + + + + diff --git a/src/Dataverse/WorkflowActivity/README.md b/src/Dataverse/WorkflowActivity/README.md index d364cbf..5dbb8e1 100644 --- a/src/Dataverse/WorkflowActivity/README.md +++ b/src/Dataverse/WorkflowActivity/README.md @@ -1,6 +1,6 @@ # TALXIS.DevKit.Build.Dataverse.WorkflowActivity -MSBuild integration for Dynamics 365 custom workflow activity assembly projects. Mirrors the Plugin package pattern: configures Visual Studio project type GUIDs, applies automatic Git-based versioning, and exposes metadata targets that allow Solution projects to discover and integrate workflow activity assemblies during build. +MSBuild integration for Dynamics 365 custom workflow activity assembly projects. Mirrors the Plugin package pattern: configures Visual Studio project type GUIDs, applies automatic Git-based versioning, merges referenced managed dependencies into the output DLL via ILRepack so the Dataverse sandbox can load all required types from a single assembly, and exposes metadata targets that allow Solution projects to discover and integrate workflow activity assemblies during build. ## Installation @@ -25,6 +25,7 @@ The package sets `ProjectType` to `WorkflowActivity` and configures `ProjectType ### Build-time targets - **TalxisBeforeBuild** (runs before `BeforeBuild`) -- executes `GenerateVersionNumber` followed by `ApplyPluginVersionNumber` to set `AssemblyVersion`, `FileVersion`, `Version`, and `PackageVersion` from Git. +- **MergeAssemblyDependencies** (runs after `Build`) -- uses [ILRepack](https://github.com/gluck/il-repack) to merge every managed DLL that landed in `$(OutDir)` into the main workflow activity assembly, so the Dataverse sandbox (which loads a single assembly) can resolve all referenced types without sibling DLLs. Sandbox-provided assemblies are skipped: `Microsoft.Xrm.Sdk*`, `Microsoft.Crm.Sdk.Proxy`, `Newtonsoft.Json`, `System.*`, `mscorlib`, `netstandard`. Idempotent — always reads the raw compiler output from `$(IntermediateOutputPath)` so the target can safely re-run within the same Solution build. Merged types keep their original public names (`Internalize=false`) to preserve Dataverse's reflection-based detection of `CodeActivity` subclasses. Disable per-project with `true`. ### Integration targets @@ -44,10 +45,11 @@ These targets are called by `TALXIS.DevKit.Build.Dataverse.Solution` when it dis | `WorkflowActivityTargetFramework` | `$(TargetFramework)` or `net462` | Target framework used to locate the compiled workflow activity DLL. | | `WorkflowActivityPublishFolderName` | `publish` | Publish folder name under `bin\\\`. | | `WorkflowActivityAssemblyId` | _(auto-generated)_ | Explicit GUID for the workflow activity assembly metadata; a new GUID is generated if empty. | +| `TalxisSkipAssemblyMerge` | _(unset)_ | When `true`, skips the post-build `MergeAssemblyDependencies` ILRepack step. | ## Related Packages -- **Depends on**: `TALXIS.DevKit.Build.Dataverse.Tasks`, `Microsoft.PowerApps.MSBuild.Plugin`, `Microsoft.CrmSdk.CoreAssemblies` +- **Depends on**: `TALXIS.DevKit.Build.Dataverse.Tasks`, `Microsoft.PowerApps.MSBuild.Plugin`, `Microsoft.CrmSdk.CoreAssemblies`, `ILRepack.Lib.MSBuild.Task` - **Consumed by**: `TALXIS.DevKit.Build.Dataverse.Solution` projects via `ProjectReference` diff --git a/src/Dataverse/WorkflowActivity/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.nuspec b/src/Dataverse/WorkflowActivity/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.nuspec index bf94329..ecbb4e5 100644 --- a/src/Dataverse/WorkflowActivity/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.nuspec +++ b/src/Dataverse/WorkflowActivity/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.nuspec @@ -18,6 +18,7 @@ + diff --git a/src/Dataverse/WorkflowActivity/msbuild/tasks/DisableILRepackAutoMerge.targets b/src/Dataverse/WorkflowActivity/msbuild/tasks/DisableILRepackAutoMerge.targets new file mode 100644 index 0000000..85b201a --- /dev/null +++ b/src/Dataverse/WorkflowActivity/msbuild/tasks/DisableILRepackAutoMerge.targets @@ -0,0 +1,5 @@ + + + + diff --git a/src/Dataverse/WorkflowActivity/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.props b/src/Dataverse/WorkflowActivity/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.props index 7cce676..a804a6c 100644 --- a/src/Dataverse/WorkflowActivity/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.props +++ b/src/Dataverse/WorkflowActivity/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.props @@ -10,5 +10,6 @@ + diff --git a/src/Dataverse/WorkflowActivity/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.targets b/src/Dataverse/WorkflowActivity/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.targets index 54aa101..253f240 100644 --- a/src/Dataverse/WorkflowActivity/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.targets +++ b/src/Dataverse/WorkflowActivity/msbuild/tasks/TALXIS.DevKit.Build.Dataverse.WorkflowActivity.targets @@ -17,6 +17,20 @@ + + + + $(MSBuildThisFileDirectory)DisableILRepackAutoMerge.targets + + + +