d365fo.tools – Publish the NuGet packages for the Azure hosted build pipeline Pt. 1

MarijanFinance & Operations3 years ago13 Views

Right in time for my previous post on using the hosted build pipeline as a gated check in, @splaxi released the newest version of the d365fo.tools. The main feature of this release being the possibility to upload the NuGet packages into the Azure DevOps artifact feed.
Thanks to the tools, it’s a lot easier to publish the packages, especially the authentication part is simplified.
Keep in mind to perform the upload from a computer with fast upload speed or it can result in a timeout error. I used an Azure DevOps TestLab VM were you get a more than solid upload.

LCS and Azure DevOps prerequisites
We start the setup by downloading the NuGet packages. Log in to LCS and navigate to the asset library of the PEAP project. Select the NuGet packages of the version you want to install, we go with the latest 10.0.18 here.

Download the four packages to your computer.

Head over to the Azure DevOps project and create a new personal access token (PAT). For this PAT we only need to select the packaging permissions to upload the packages.

Write down the PAT and we are done with this step.

Setup NuGet Package Source
Open an elevated powershell command prompt and install the latest d365fo.tools and NuGet.

Install-Module -Name d365fo.tools (-Force to update)
Invoke-D365InstallNuget

NuGet will be installed under the default path C:Tempd365fo.toolsnuget . Now we can start to register a local NuGet source.
To register the source we need the PAT and the Azure DevOps artifact feed URL.

cd "C:Tempd365fo.toolsNuGet"
.nuget sources add -Name "DevOpsHostedBuild" -Source "https://pkgs.dev.azure.com/MariDevOps/DevOpsBuild/_packaging/D365HostedBuild/nuget/v3/index.json" -username "AzureDevOps Email Address" -password "PAT"

Check if this step was successful, go to “%AppData%NuGet” and check the “NuGet.Config” file. The config file should look like this.

When we add other package sources they will be added to the config file. Thanks to this, we can then switch between Azure DevOps projects to publish NuGet packages by using the name. Hint: seems there is a security issue with multiple NuGet feeds in the config, so better stick to one feed: https://www.bleepingcomputer.com/news/security/researcher-hacks-over-35-tech-firms-in-novel-supply-chain-attack/amp/?__twitter_impression=true

Publish NuGet packages
Now we’re almost done, to push the packages to the artifact feed. Copy the four downloaded packages to “C:Tempd365fo.toolsnuget”. In the powershell command prompt invoke the “Invoke-D365AzureDevOpsNugetPush” command. Notice the -Source parameter which controls to which artifact feed we’re publishing the packages.

Invoke-D365AzureDevOpsNugetPush -Path "Microsoft.Dynamics.AX.Application.DevALM.BuildXpp.10.0.793.16.nupkg" -Source "DevopsHostedBuild" -ShowOriginalProgress

Repeat this for the remaining three packages and you should be done.

Azure DevOps Artifact feed should look like this:

With the artifacts in place you can go on and setup the azure hosted build. Use the official documentation or the MSDyn365 & AZure DevOps ALM guide.

In the next part we will use the d365fo.tools to automatically check if there is a newer NuGet package available and if so, then upload it autoatically to your artifact feed.

Original Post https://d365fostuff.wordpress.com/2021/03/13/d365fo-tools-publish-the-nuget-packages-for-the-azure-hosted-build-pipeline-pt-1/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
March 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       
« Feb   Apr »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...