Add licenses to deployable package
- In the relevant branch create the
Licenses folder
- add all required license files to that folder (txt files). If you have a deployable package with licenses you can get txt files from that deployable zip package (AosService\Scripts\License)
- find the existing "
Add Licenses to Deployable Package" step in the pipeline or add it
- step should be placed just before Publish Artifact: Packages step
- modify "
Add Licenses to Deployable Package" step
Check workspace mappings (
Get sources step), in this case, it is getting sources directly to
$(Build.SourcesDirectory):
Therefore
Search pattern should be:
$(Build.SourcesDirectory)\Licenses\*.txt
Check
Copy Files to: Staging Directory to identify the location:
Go to any successful pipeline run details and open
Related/N published
Expand the Packages folder and see the exact package name:
Take note that the file name consists of (separated by underscore)
- AXDeployableRuntime
- Build number of D365 F&SCM platform
- Build number (pipeline)
Set
Filename and path:
$(Build.ArtifactStagingDirectory)\Packages\AXDeployableRuntime_7.0.6931.60_$(Build.BuildNumber).zip
Final look of the
Add licenses to Deployable Package step:
If you want to automate platform build number as well - follow the steps in the end.
- make a test pipeline run and download the prepared zip package, make sure that under AosService\Scripts\License it contains relevant license files
Automate Platform build number
- add new variable
PlatformBuildVersion
- add additional task
PowerShell and call is "
PowerShell Script - set PlatformBuildVersion"
- place step before
Add Licenses to Deployable Package:
- change step properties:
Switch
Type to
Inline
Script:
Add-Type -Path "K:\AosService\PackagesLocalDirectory\bin\Microsoft.Dynamics.BusinessPlatform.ProductInformation.Provider.dll"
[Microsoft.Dynamics.BusinessPlatform.ProductInformation.Provider.ProductInfoProvider] $provider = [Microsoft.Dynamics.BusinessPlatform.ProductInformation.Provider.ProductInfoProvider]::get_Provider();
$PlatBuild = $provider.PlatformBuildVersion
Write-Host $PlatBuild
Write-Host "##vso[task.setvariable variable=PlatformBuildVersion]$PlatBuild"
- change
Filename and path property of
Add licenses to Deployable Package step to:
$(Build.ArtifactStagingDirectory)\Packages\AXDeployableRuntime_$(PlatformBuildVersion)_$(Build.BuildNumber).zip
References: