Dynamically Selecting Package based on latest deployed

Hi,

I have built a project that deploys a Nuget package.

My intention is to use the same project to deploy a variety of packages with different names.

Even though the project relates to one website. Each project relating to this website, has a special project code with its own version number sequence.

Website_project1 (version 1.0.0 to 1.9.9)
Website_project2 (version 1.0.0 to 2.9.9)
etc

Therefore the nuget package id will equal Website_project1 and version 1.0.1

Once this package has been completely deployed a new project will be created, e.g. Website_project2 starting with version 1.0.0

Nuget file would like the following:

image

However in my project “Deploy a package” step, I am currently hardcoding. Therefore it either needs to be hardcoded to Website_project1 or Website_project2.

Basically what I am wanting is to have this dynamically select the last package deployed or if this is not possible prompt the user to select a package when doing the release.

Any advise would be highly appreciated.

Thanks,
Damien

Hi Damien,

Thanks for getting in touch! I can think of a few options that might address what you’re after, one of which being a prompt for the user to select the package ID.

  • You can bind the Package Id selection on the step to a variable. So you’d create a project variable containing the package IDs which you can set to Prompt for value which will prompt the user to specify the package ID at deployment time. You can also set the Control type to Dropdown to easily provide the valid options. This variable might look like this:



    With this approach, keep in mind that a valid package ID has to be resolvable at release creation time. Since prompted variables have their values supplied at deployment time (after release creation), you’d need to define a default value for the variable that evaluates to an existing package ID (which will evaluate to a different value during the deployment).

  • Separate this step into multiple so you can specify a different package ID per step. You can disable one of these steps then create a release which will control only one package per deployment.

  • Separate this project into multiple projects, each with their own package deployment steps.

Would one of those options work and give you the result you’re after? Let me know what you think, or if there’s something I seem to not be understanding. :slight_smile:

Best regards,

Kenny

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.