Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5dd9d0e
Solution and pdpackage targets overrode. ScriptLibrary targets added
zekelinAlex Nov 25, 2025
b5d0c57
Script library build update
zekelinAlex Nov 26, 2025
a0507f7
sdk base created
zekelinAlex Dec 4, 2025
253cb05
sdk complited
zekelinAlex Dec 5, 2025
11a48e6
sdk complited
zekelinAlex Dec 5, 2025
7a0d42c
branches merged
zekelinAlex Dec 5, 2025
f13b12d
Merge pull request #1 from zekelinAlex/Solution
zekelinAlex Dec 5, 2025
d833284
data.xml files generating added
zekelinAlex Dec 30, 2025
24a9b9d
rootcomponet generating
zekelinAlex Dec 30, 2025
9d16131
pluginassembly.data.xml generatinng added
zekelinAlex Dec 30, 2025
75019b7
data.xml files generating added (v2)
zekelinAlex Jan 2, 2026
450b3ff
data.xml files generating added (v3)
zekelinAlex Jan 2, 2026
675e0df
data.xml files generating added (done)
zekelinAlex Jan 2, 2026
9bbab8e
Solution.xml management added
zekelinAlex Jan 5, 2026
0a5ed7f
Plugins and script library update
zekelinAlex Jan 5, 2026
e603a67
Update
zekelinAlex Jan 8, 2026
0059f8f
Cmt package build
zekelinAlex Jan 9, 2026
c504273
Cmt package include exclude
zekelinAlex Jan 14, 2026
9d618d3
Readme added
zekelinAlex Jan 14, 2026
08ac843
bugs fixed
zekelinAlex Jan 16, 2026
b8bb5ad
Plugin bug fixed
zekelinAlex Jan 17, 2026
1f02e6a
Merge branch 'plugins' of https://github.com/zekelinAlex/tools-devkit…
zekelinAlex Jan 19, 2026
f182b67
remove unnesesarly files
zekelinAlex Jan 19, 2026
8e158f4
data.xml generating changed
zekelinAlex Jan 20, 2026
7d535de
No plugin dll copy
zekelinAlex Jan 20, 2026
bdee86e
plugin dll copy
zekelinAlex Jan 20, 2026
2457d6d
plugin dll copy
zekelinAlex Jan 20, 2026
b4e25db
plugin dll copy to metadata. plugin assemply any folder
zekelinAlex Jan 25, 2026
6b8da45
data.xml version generating
zekelinAlex Jan 25, 2026
9c9535f
metadata set up
zekelinAlex Jan 25, 2026
7e6e243
Custom Temp folder
zekelinAlex Jan 25, 2026
5abcd29
Custom Temp folder
zekelinAlex Jan 25, 2026
383d01f
publisher prefix condition
zekelinAlex Jan 26, 2026
ff989fd
script library build update
zekelinAlex Jan 26, 2026
01dec11
workfow
zekelinAlex Jan 26, 2026
adb4c1d
workfow
zekelinAlex Jan 26, 2026
7efefd1
WorkflowActivity targets
zekelinAlex Jan 26, 2026
f7ce21e
Merge pull request #2 from zekelinAlex/plugins
zekelinAlex Jan 27, 2026
6934b6b
<GeneratePluginAssembly>false</GeneratePluginAssembly>
zekelinAlex Jan 28, 2026
81c6b99
warkflow targetts finished
zekelinAlex Jan 29, 2026
8dbfab2
Plugin assemblys enshure Tasks update
zekelinAlex Jan 29, 2026
1343d88
.resx support added
zekelinAlex Feb 2, 2026
2467268
Solutions to nuget packages
zekelinAlex Feb 2, 2026
2831322
PDPackages to nuget packages
zekelinAlex Feb 2, 2026
b0010a5
ScriptLibrary update
zekelinAlex Feb 2, 2026
a9e19e4
Merge pull request #3 from zekelinAlex/SolutionNugetPackages
zekelinAlex Feb 2, 2026
86b88f8
Script library build update
zekelinAlex Feb 2, 2026
0cb6b41
pacjaging update
zekelinAlex Feb 4, 2026
37cd286
Readme update
zekelinAlex Feb 9, 2026
4abcd60
Pdpackage bug fixed
zekelinAlex Feb 9, 2026
acb0216
cmt package dependency
zekelinAlex Feb 10, 2026
99a247c
Ilrepac paraniter
zekelinAlex Feb 10, 2026
acc2b39
NugetPackageTypeValue
zekelinAlex Feb 10, 2026
dc5ea4f
MicrosoftPowerAppsTargetsVersion
zekelinAlex Feb 10, 2026
294ff11
Version
zekelinAlex Feb 10, 2026
567c0c5
MicrosoftPowerAppsTargetsVersion
zekelinAlex Feb 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,6 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml



13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ Generates version numbers based on Git commit history, applying these versions a
#### Build Number From Dependencies
Project dependency folders are analyzed for Git changes to be reflected in generated version numbers. See [here](/docs/Versioning.md) for more details.

## Packages

| Package | Description |
|---------|-------------|
| [TALXIS.DevKit.Build.Sdk](src/Dataverse/Sdk/README.md) | MSBuild SDK that auto-resolves the correct package based on `ProjectType`. Entry point for new projects. |
| [TALXIS.DevKit.Build.Dataverse.Tasks](src/Dataverse/Tasks/README.md) | Core MSBuild tasks shared by all packages: Git versioning, schema validation, solution packaging, CMT data merging. |
| [TALXIS.DevKit.Build.Dataverse.Solution](src/Dataverse/Solution/README.md) | Orchestrates the full Dataverse solution build: component discovery, XML patching, PAC solution packager, NuGet packing. |
| [TALXIS.DevKit.Build.Dataverse.Plugin](src/Dataverse/Plugin/README.md) | MSBuild integration for Dataverse plugin assemblies with auto-versioning and metadata exposure for Solution projects. |
| [TALXIS.DevKit.Build.Dataverse.Pcf](src/Dataverse/Pcf/README.md) | MSBuild integration for PCF controls. Wraps `Microsoft.PowerApps.MSBuild.Pcf` with Git-based versioning. |
| [TALXIS.DevKit.Build.Dataverse.WorkflowActivity](src/Dataverse/WorkflowActivity/README.md) | MSBuild integration for custom workflow activity assemblies with auto-versioning and Solution project integration. |
| [TALXIS.DevKit.Build.Dataverse.ScriptLibrary](src/Dataverse/ScriptLibrary/README.md) | Builds TypeScript/JS web resource projects (`npm install` + `npm run build`) and integrates them into Solution builds. |
| [TALXIS.DevKit.Build.Dataverse.PdPackage](src/Dataverse/PDPackage/README.md) | Package Deployer integration with ILRepack assembly merging and CMT metadata merge/zip support. |

## Getting Started
> [!TIP]
> You can find demo steps for creating a new solution using PAC CLI and this package [here](https://tntg.cz/repo-init-demo).
Expand Down
3 changes: 3 additions & 0 deletions TALXIS.DevKit.Build.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
<Project Path="src/Dataverse/Solution/TALXIS.DevKit.Build.Dataverse.Solution.csproj" />
<Project Path="src/Dataverse/Plugin/TALXIS.DevKit.Build.Dataverse.Plugin.csproj" />
<Project Path="src/Dataverse/Pcf/TALXIS.DevKit.Build.Dataverse.Pcf.csproj" />
<Project Path="src/Dataverse/ScriptLibrary/TALXIS.DevKit.Build.Dataverse.ScriptLibrary.csproj" />
<Project Path="src/Dataverse/PDPackage/TALXIS.DevKit.Build.Dataverse.PdPackage.csproj" />

</Solution>
99 changes: 99 additions & 0 deletions src/Dataverse/PDPackage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# 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

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

Or use the SDK approach:

```xml
<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`.

### 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


Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version Condition="'$(Version)'==''">0.0.0.1</Version>
<ILRepackVersion Condition="'$(ILRepackVersion)'==''">2.0.18</ILRepackVersion>
<NuspecFile>TALXIS.DevKit.Build.Dataverse.PdPackage.nuspec</NuspecFile>
<NuspecProperties>Version=$(Version);ILRepackVersion=$(ILRepackVersion)</NuspecProperties>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>TALXIS.DevKit.Build.Dataverse.PdPackage</id>
<version>$Version$</version>
<authors>TALXIS</authors>
<developmentDependency>true</developmentDependency>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<readme>README.md</readme>
<projectUrl>https://github.com/TALXIS/tools-devkit-build</projectUrl>
<description>Dataverse MSBuild PDPackage</description>
<releaseNotes>https://github.com/TALXIS/tools-devkit-build/releases</releaseNotes>
<copyright>2025 NETWORG</copyright>
<repository type="git" url="https://github.com/TALXIS/tools-devkit-build"
commit="c941d55d453c1c64a1e248a240b0327d2dcd76ee" />
<dependencies>
<dependency id="Microsoft.PowerApps.MSBuild.PDPackage" version="$MicrosoftPowerAppsTargetsVersion$" />
<dependency id="ilrepack" version="[$ILRepackVersion$]" />
<dependency id="TALXIS.DevKit.Build.Dataverse.Tasks" version="$Version$" />
</dependencies>
</metadata>
<files>
<file src="msbuild\tasks\*.*" target="tasks" />
<file src="msbuild\build\*.*" target="build" />
<file src="README.md" target="" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PdPackageMsBuildVersion Condition="'$(PdPackageMsBuildVersion)'==''">1.50.1</PdPackageMsBuildVersion>
<!-- Disable Microsoft's GeneratePdPackageOnPublish; TALXIS TalxisGeneratePdPackageOnBuild handles this instead -->
<GeneratePdPackageOnPublish>false</GeneratePdPackageOnPublish>
<_PdPackageMsBuildProps Condition="'$(_PdPackageMsBuildProps)'==''">
$(NuGetPackageRoot)microsoft.powerapps.msbuild.pdpackage\$(PdPackageMsBuildVersion)\build\Microsoft.PowerApps.MSBuild.PDPackage.props
</_PdPackageMsBuildProps>
</PropertyGroup>

<Import Project="$(_PdPackageMsBuildProps)" Condition="Exists('$(_PdPackageMsBuildProps)')" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PdPackageMsBuildVersion Condition="'$(PdPackageMsBuildVersion)'==''">1.50.1</PdPackageMsBuildVersion>
<_PdPackageMsBuildTargets Condition="'$(_PdPackageMsBuildTargets)'==''">
$(NuGetPackageRoot)microsoft.powerapps.msbuild.pdpackage\$(PdPackageMsBuildVersion)\build\Microsoft.PowerApps.MSBuild.PDPackage.targets
</_PdPackageMsBuildTargets>
</PropertyGroup>

<Import Project="$(_PdPackageMsBuildTargets)" Condition="Exists('$(_PdPackageMsBuildTargets)')" />

<Import Project="$(MSBuildThisFileDirectory)..\tasks\$(MSBuildThisFileName).targets" />
<Import Project="$(MSBuildThisFileDirectory)..\tasks\TALXIS.DevKit.Build.Dataverse.PdPackage.ImportConfig.targets"
Condition="Exists('$(MSBuildThisFileDirectory)..\tasks\TALXIS.DevKit.Build.Dataverse.PdPackage.ImportConfig.targets')" />
<Import Project="$(MSBuildThisFileDirectory)..\tasks\TALXIS.DevKit.Build.Dataverse.CmtPackage.targets"
Condition="Exists('$(MSBuildThisFileDirectory)..\tasks\TALXIS.DevKit.Build.Dataverse.CmtPackage.targets')" />
<Import Project="$(MSBuildThisFileDirectory)..\tasks\TALXIS.DevKit.Build.Dataverse.CmtPackage.Main.targets"
Condition="Exists('$(MSBuildThisFileDirectory)..\tasks\TALXIS.DevKit.Build.Dataverse.CmtPackage.Main.targets')" />
<Import Project="$(MSBuildThisFileDirectory)..\tasks\TALXIS.DevKit.Build.Dataverse.PdPackage.ILRepack.targets"
Condition="Exists('$(MSBuildThisFileDirectory)..\tasks\TALXIS.DevKit.Build.Dataverse.PdPackage.ILRepack.targets')" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<Project>
<PropertyGroup>
<_CmtMetadataImportConfigDir Condition="'$(_CmtMetadataImportConfigDir)'=='' and '$(_GeneratedPdImportConfig)'!=''">$([System.IO.Path]::GetDirectoryName('$(_GeneratedPdImportConfig)'))</_CmtMetadataImportConfigDir>
<_CmtMetadataImportConfigDir Condition="'$(_CmtMetadataImportConfigDir)'==''">$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)'))</_CmtMetadataImportConfigDir>

<CmtMetadataOutputDir Condition="'$(CmtMetadataOutputDir)'==''">
$([System.IO.Path]::Combine('$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)'))','CmtMetadata','$(CmtMetadataZipName)'))
</CmtMetadataOutputDir>
<CmtMetadataOutputDir>$([System.String]::Copy('$([System.Text.RegularExpressions.Regex]::Replace('$(CmtMetadataOutputDir)','[\\/]+$', ''))').Trim())</CmtMetadataOutputDir>

<_CmtMetadataDataXml>$([System.IO.Path]::Combine('$(CmtMetadataOutputDir)','data.xml'))</_CmtMetadataDataXml>
<_CmtMetadataDataSchemaXml>$([System.IO.Path]::Combine('$(CmtMetadataOutputDir)','data_schema.xml'))</_CmtMetadataDataSchemaXml>
<_CmtMetadataContentTypes>$([System.IO.Path]::Combine('$(CmtMetadataOutputDir)','[Content_Types].xml'))</_CmtMetadataContentTypes>
<CmtMetadataZipName Condition="'$(CmtMetadataZipName)'=='' and '$(CmtPackageName)'!=''">$(CmtPackageName)</CmtMetadataZipName>
<CmtMetadataZipName Condition="'$(CmtMetadataZipName)'==''">MainCmtPackage</CmtMetadataZipName>
<CmtMetadataZipFile>$([System.IO.Path]::Combine('$(CmtPackageOutputDir)','$(CmtMetadataZipName).zip'))</CmtMetadataZipFile>
<CmtMetadataZipFileName>$([System.IO.Path]::GetFileName('$(CmtMetadataZipFile)'))</CmtMetadataZipFileName>
<CmtMetadataLcid Condition="'$(CmtMetadataLcid)'==''"></CmtMetadataLcid>
<CmtMetadataUserMapFileName Condition="'$(CmtMetadataUserMapFileName)'==''"></CmtMetadataUserMapFileName>
<CmtImportConfigPath Condition="'$(CmtImportConfigPath)'==''"></CmtImportConfigPath>

<_CmtMetadataContentTypesContent><![CDATA[<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/octet-stream" /></Types>]]></_CmtMetadataContentTypesContent>
</PropertyGroup>

<Target Name="TalxisPrepareCmtPackageMetadata"
DependsOnTargets="TalxisDiscoverCmtPackages"
AfterTargets="UpdatePdImportConfigToGenerated"
BeforeTargets="ComputeResolvedFilesToPublishList"
Condition="'$(_TalxisCmtMetadataPrepared)'!='true'">

<PropertyGroup>
<_CmtPdImportConfig>@(PdImportConfig->'%(FullPath)')</_CmtPdImportConfig>
<CmtImportConfigPath Condition="'$(CmtImportConfigPath)'=='' and '$(AutoGeneratePdImportConfig)'=='true'">$(_GeneratedPdImportConfig)</CmtImportConfigPath>
<CmtImportConfigPath Condition="'$(CmtImportConfigPath)'=='' and '$(_CmtPdImportConfig)'!=''">$([System.IO.Path]::GetFullPath('$(_CmtPdImportConfig)'))</CmtImportConfigPath>
<CmtImportConfigPath Condition="'$(CmtImportConfigPath)'==''">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)','PkgAssets','ImportConfig.xml'))</CmtImportConfigPath>
<_CmtWorkingImportConfig Condition="'$(_CmtWorkingImportConfig)'==''">$([System.IO.Path]::Combine('$(_CmtMetadataImportConfigDir)','ImportConfig.cmt.g.xml'))</_CmtWorkingImportConfig>
<_HasCmtPackages>@(_CmtPackageDirs)</_HasCmtPackages>
</PropertyGroup>

<Message Text="No Cmt packages discovered; skipping metadata merge." Importance="Low"
Condition="'$(_HasCmtPackages)'==''" />

<Copy SourceFiles="$(CmtImportConfigPath)"
DestinationFiles="$(_CmtWorkingImportConfig)"
SkipUnchangedFiles="true"
Condition="'$(CmtImportConfigPath)'!='' and Exists('$(CmtImportConfigPath)') and '$(AutoGeneratePdImportConfig)'!='true'">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>

<ItemGroup Condition="Exists('$(_CmtWorkingImportConfig)') and '$(AutoGeneratePdImportConfig)'!='true'">
<PdImportConfig Remove="@(PdImportConfig)" />
<PdImportConfig Include="$(_CmtWorkingImportConfig)" />
</ItemGroup>

<PropertyGroup Condition="Exists('$(_CmtWorkingImportConfig)') and '$(AutoGeneratePdImportConfig)'!='true'">
<CmtImportConfigPath>$(_CmtWorkingImportConfig)</CmtImportConfigPath>
</PropertyGroup>

<ItemGroup>
<_CmtPackageMetadata Include="@(_CmtPackageDirs)">
<DataXml>$([System.IO.Path]::Combine('%(_CmtPackageDirs.Identity)','data.xml'))</DataXml>
<DataSchemaXml>$([System.IO.Path]::Combine('%(_CmtPackageDirs.Identity)','data_schema.xml'))</DataSchemaXml>
</_CmtPackageMetadata>
</ItemGroup>

<Error Condition="'$(_HasCmtPackages)'!='' and !Exists('%(_CmtPackageMetadata.DataXml)')" Text="data.xml not found for Cmt package: %(_CmtPackageMetadata.Identity)" />
<Error Condition="'$(_HasCmtPackages)'!='' and !Exists('%(_CmtPackageMetadata.DataSchemaXml)')" Text="data_schema.xml not found for Cmt package: %(_CmtPackageMetadata.Identity)" />

<MakeDir Directories="$(CmtMetadataOutputDir)" Condition="'$(_HasCmtPackages)'!=''" />

<MergeCmtDataXml DataXmlFiles="@(_CmtPackageMetadata->'%(DataXml)')"
CmtPackageName="$(CmtPackageName)"
ProjectDirectory="$(MSBuildProjectDirectory)"
OutputDirectory="$(CmtMetadataOutputDir)"
Condition="'$(_HasCmtPackages)'!=''">
<Output TaskParameter="OutputDataXml" ItemName="FileWrites" />
</MergeCmtDataXml>

<MergeCmtDataSchemaXml DataSchemaFiles="@(_CmtPackageMetadata->'%(DataSchemaXml)')"
CmtPackageName="$(CmtPackageName)"
ProjectDirectory="$(MSBuildProjectDirectory)"
OutputDirectory="$(CmtMetadataOutputDir)"
Condition="'$(_HasCmtPackages)'!=''">
<Output TaskParameter="OutputDataSchemaXml" ItemName="FileWrites" />
</MergeCmtDataSchemaXml>

<WriteLinesToFile
File="$(_CmtMetadataContentTypes)"
Lines="$(_CmtMetadataContentTypesContent)"
Overwrite="true"
Encoding="UTF-8"
Condition="'$(_HasCmtPackages)'!=''" />

<MakeDir Directories="$(CmtPackageOutputDir)" Condition="'$(CmtPackageOutputDir)'!='' and '$(_HasCmtPackages)'!=''" />
<ZipDirectory SourceDirectory="$(CmtMetadataOutputDir)"
DestinationFile="$(CmtMetadataZipFile)"
Overwrite="true"
Condition="'$(CmtMetadataZipFile)'!='' and '$(_HasCmtPackages)'!=''" />

<AppendCmtDataFileToImportConfig
ImportConfigPath="$(CmtImportConfigPath)"
FileName="$(CmtMetadataZipFileName)"
Lcid="$(CmtMetadataLcid)"
UserMapFileName="$(CmtMetadataUserMapFileName)"
Condition="'$(_HasCmtPackages)'!='' and Exists('$(CmtImportConfigPath)') and '$(CmtMetadataZipFileName)'!=''">
<Output TaskParameter="UpdatedImportConfig" ItemName="FileWrites" />
</AppendCmtDataFileToImportConfig>

<ItemGroup>
<FileWrites Include="$(_CmtMetadataContentTypes)" Condition="'$(_HasCmtPackages)'!=''" />
<FileWrites Include="$(CmtMetadataZipFile)" Condition="'$(CmtMetadataZipFile)'!='' and '$(_HasCmtPackages)'!=''" />
</ItemGroup>

<PropertyGroup>
<_TalxisCmtMetadataPrepared>true</_TalxisCmtMetadataPrepared>
</PropertyGroup>

<Message Text="Cmt metadata merged into $(CmtMetadataOutputDir)" Importance="High" Condition="'$(_HasCmtPackages)'!=''" />
</Target>

<Target Name="TalxisPublishCmtPackageMetadata"
AfterTargets="ComputeResolvedFilesToPublishList"
DependsOnTargets="TalxisPrepareCmtPackageMetadata"
Condition="'$(CmtMetadataZipFile)'!='' and Exists('$(CmtMetadataZipFile)')">
<ItemGroup>
<ResolvedFileToPublish Include="$(CmtMetadataZipFile)">
<RelativePath>$(PdAssetsTargetFolder)\$(CmtMetadataZipFileName)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
</Project>
Loading