Octopack not working if I have more than one nuget.exe

The following command doesn’t work if you have more than one nuget.exe

msbuild MyWebApplication.csproj "/t:Rebuild" "/t:ResolveReferences" "/t:_CopyWebApplication" /p:Configuration=Release /p:WebProjectOutputDir=publish\ /p:OutDir=publish\bin\

The reason for this is the row

      Condition="!Exists('$(NuGetExe)')"

In combination with having more than one package containing a nuget.exe file. I don’t know exactly how to solve it since I’m not a msbuild expert.

Ok, so I became a msbuild expert and found a solution for you:

if you change the line

        <NuGetExe Condition="'$(OctopusNuGetExePath)' == ''">@(FindNuGet)</NuGetExe>

to

        <NuGetExe Condition="'$(OctopusNuGetExePath)' == ''">%(FindNuGet.Identity)</NuGetExe>

you will get a better solution. Basically what that line is doing is taking all the files it found and assigning it one by one to NuGetExe which result in it having the latest value in the list.

I could make a pull request if you have the OctoPack project on github or somewhere else.

Hi Thomas,

Thanks for the help, I applied this change in OctoPack:
https://github.com/OctopusDeploy/OctoPack/blob/master/source/targets/OctoPack.targets

Paul