Skip to content

Latest commit

 

History

History
107 lines (70 loc) · 5.38 KB

File metadata and controls

107 lines (70 loc) · 5.38 KB

TALXIS.DevKit.Build.Dataverse.PdPackage

MSBuild integration for Power Platform Package Deployer (PD) packages. Wraps Microsoft.PowerApps.MSBuild.PDPackage, adds ILRepack-based assembly merging for the deployment package DLL, and provides Configuration Migration Tool (CMT) package discovery, metadata merging, and zipping.

Installation

<PackageReference Include="TALXIS.DevKit.Build.Dataverse.PdPackage" Version="0.0.0.1" PrivateAssets="All" />

Or use the SDK approach:

<Project Sdk="TALXIS.DevKit.Build.Sdk/0.0.0.1">
  <PropertyGroup>
    <ProjectType>PdPackage</ProjectType>
  </PropertyGroup>
</Project>

How It Works

Microsoft PDPackage import

Props and targets from Microsoft.PowerApps.MSBuild.PDPackage are imported automatically. The version is controlled by PdPackageMsBuildVersion.

Defaults for ProjectReference

All ProjectReference items default to ReferenceOutputAssembly=false via ItemDefinitionGroup. PDPackage projects reference other projects (e.g. Solution) purely for build ordering and packaging, not to consume their output assemblies as compile-time references. Override per-reference by explicitly setting ReferenceOutputAssembly="true".

.NET Framework references

System.ComponentModel.Composition is automatically referenced when targeting .NET Framework. This is required by Microsoft.CrmSdk.XrmTooling.PackageDeployment (MEF / IImportPackageExtension).

Project reference filtering

_DetectPdProjectReferenceTypes probes all ProjectReference items for GetProjectType. Solution-type references have ReferenceOutputAssembly set to false so their DLLs are not included in the package output.

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.

CMT package discovery

TalxisDiscoverCmtPackages scans for folders containing [Content_Types].xml with sibling data.xml and data_schema.xml. Supports include/exclude filtering via IncludedCmtPackages/ExcludedCmtPackages.

CMT package zipping

TalxisZipCmtPackages (runs after Build) zips each discovered CMT package directory into CmtPackageOutputDir.

CMT metadata merging

TalxisPrepareCmtPackageMetadata merges data.xml and data_schema.xml from all CMT packages into a single combined package, generates [Content_Types].xml, zips it, and appends a reference to ImportConfig.xml.

Publishing and NuGet packing

dotnet publish is the primary build command. It publishes the project, generates the .pdpkg.zip via GeneratePdPackage, and then automatically runs Pack to produce a .nupkg containing the .pdpkg.zip (controlled by GeneratePackageOnPublish).

MSBuild Properties

PDPackage

Property Default Description
PdPackageMsBuildVersion 1.50.1 Version of Microsoft.PowerApps.MSBuild.PDPackage imported by the package.
GeneratePdPackageOnBuild true Runs GeneratePdPackage after publish.
GeneratePackageOnPublish true Triggers NuGet pack after dotnet publish to produce a .nupkg containing the .pdpkg.zip.

ILRepack

Property Default Description
DataversePackageRunILRepack true Runs ILRepack after build.
SkipPackageILRepack (none) Set to true to skip ILRepack.
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.

CMT packages

Property Default Description
CmtPackageSearchRoot Project directory Root folder scanned for CMT packages.
CmtPackageOutputDir $(TargetDir)\CmtPackages Output folder for zipped CMT packages.
IncludedCmtPackages (none) Semicolon-separated package names to include (case-insensitive).
ExcludedCmtPackages (none) Semicolon-separated package names to exclude (case-insensitive).

CMT metadata merge

Property Default Description
CmtPackageName (none) Name injected into merged metadata.
CmtMetadataOutputDir $(IntermediateOutputPath)\CmtMetadata\$(CmtMetadataZipName) Temp folder for merged metadata.
CmtMetadataZipName $(CmtPackageName) or MainCmtPackage Name of the merged metadata zip.
CmtMetadataLcid (none) LCID used when appending metadata to ImportConfig.
CmtMetadataUserMapFileName (none) Optional user map file name used in ImportConfig.
CmtImportConfigPath (none) Path to ImportConfig.xml used for metadata injection.
AutoGeneratePdImportConfig (none) When true, uses the generated ImportConfig instead of copying a project file.
PdAssetsTargetFolder (none) Target folder under publish assets for the merged metadata zip.

Related Packages

  • Depends on: Microsoft.PowerApps.MSBuild.PDPackage, ilrepack
  • Typically references: TALXIS.DevKit.Build.Dataverse.Solution projects