Octo push --package to use latest nuget file

Currently, we have to specify the exact nuget file name for octo.exe push --package param. i’m trying to write a script that will run msbuild and publish package to a local packages directory. Then I want to run octo.exe push command to push that package to octopus built-in repo. The problem I have is that I don’t have the exact file name produced by the msbuild command to use in the octo push command.

Is there a way to run octo.exe push --package and have it use the latest nuget file instead of the exact file name? Is there a way to get the file name produced by msbuild?

Things I’m trying to avoid:

  1. Custom msbuild task to write the version number somewhere on file to then read and plug into octo command.
  2. Read all the files in the package directory before msbuild and again after and find out what the diff file was.

Hi Mohamed,

Thanks for getting in touch! If I understand correctly you want to build nuget packages and then push them to your Octopus server? If that’s correct then you can use Octopack to solve your problem without having to write a single line of MSBuild code.

Please let me know how you go.

Regards

Pawel

I am trying to run these 2 commands in a script in sequence.

  1. msbuild /p:RunOctoPack=true /p:OctoPackPublishPackageToFileShare=C:\Packages
  2. Octo.exe push --package My.NugetPackage.Name.1.0.6148.20110.nupkg --replace-existing --server http://**** --apiKey API-***

The problem is that I don’t know what the nuget package file name ‘My.NugetPackage.Name.1.0.6148.20110.nupkg’ was created from step 1 so I can use it in step 2 like you can see in the example.

Is there a way to get the nuget file name from step 1 so i can use it for the --package param in step 2?

Hi Mohamed,

Thanks for your reply. You can combine those two steps into one and in this way you don’t have to know the name of the packages:
msbuild /p:RunOctoPack=true /p:OctoPackPublishPackageToHttp=http://YOUR_OCTOPUS_SERVER /p:OctoPackPublishApiKey=API-ABCDEFGMYAPIKEY

Please let me know how you go.

Pawel