Octopus Deploy for Class Library

I am trying to publish classlibrary nuget packages using the below command in msbuild argument.

/p:RunOctoPack=true;OctoPackPublishPackageToHttp=http://nuget.hrbl.net:8088/;OctoPackPublishApiKey=xxxxxxxx

however I get an error below…

 D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Core.AuthenticationProvider\MyHerbalife3.Core.AuthenticationProvider.csproj (243): OctoPack cannot be run because NuGet packages were restored prior to the build running, and the targets file was unavailable when the build started. Please build the project again to include these packages in the build. You may also need to make sure that your build server does not delete packages prior to each build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568.
 D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Shared.Infrastructure\MyHerbalife3.Shared.Infrastructure.csproj (225): OctoPack cannot be run because NuGet packages were restored prior to the build running, and the targets file was unavailable when the build started. Please build the project again to include these packages in the build. You may also need to make sure that your build server does not delete packages prior to each build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568.
 Could not find a part of the path 'D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Shared.ViewModel\bin\Release'.
 There was an error calling NuGet. Please see the output above for more details. Command line: 'D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\packages\OctoPack.3.0.42\tools\NuGet.exe' pack "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Shared.ViewModel\obj\octopacking\MyHerbalife3.Shared.ViewModel.nuspec"  -NoPackageAnalysis -BasePath "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Shared.ViewModel" -OutputDirectory "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Shared.ViewModel\obj\octopacked" -Version 1.0.1-alpha -NoDefaultExcludes
 System.Exception: There was an error calling NuGet. Please see the output above for more details. Command line: 'D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\packages\OctoPack.3.0.42\tools\NuGet.exe' pack "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Shared.ViewModel\obj\octopacking\MyHerbalife3.Shared.ViewModel.nuspec"  -NoPackageAnalysis -BasePath "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Shared.ViewModel" -OutputDirectory "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Shared.ViewModel\obj\octopacked" -Version 1.0.1-alpha -NoDefaultExcludes
   at OctoPack.Tasks.CreateOctoPackPackage.RunNuGet(String specFilePath, String octopacking, String octopacked, String projectDirectory) in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 551
   at OctoPack.Tasks.CreateOctoPackPackage.Execute() in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 196
 Could not find a part of the path 'D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Core.AdminProvider\bin\Release'.
 There was an error calling NuGet. Please see the output above for more details. Command line: 'D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\packages\OctoPack.3.0.42\tools\NuGet.exe' pack "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Core.AdminProvider\obj\octopacking\MyHerbalife3.Core.AdminProvider.nuspec"  -NoPackageAnalysis -BasePath "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Core.AdminProvider" -OutputDirectory "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Core.AdminProvider\obj\octopacked" -Version 1.0.1-alpha -NoDefaultExcludes
 System.Exception: There was an error calling NuGet. Please see the output above for more details. Command line: 'D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\packages\OctoPack.3.0.42\tools\NuGet.exe' pack "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Core.AdminProvider\obj\octopacking\MyHerbalife3.Core.AdminProvider.nuspec"  -NoPackageAnalysis -BasePath "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Core.AdminProvider" -OutputDirectory "D:\b\38\2064\src\DTS\App\Web\MyHerbalife3\MyHerbalife3.Shared.Core\R2\MyHerbalife3.Core.AdminProvider\obj\octopacked" -Version 1.0.1-alpha -NoDefaultExcludes
   at OctoPack.Tasks.CreateOctoPackPackage.RunNuGet(String specFilePath, String octopacking, String octopacked, String projectDirectory) in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 551
   at OctoPack.Tasks.CreateOctoPackPackage.Execute() in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 196

Hi,

Thanks for getting in touch. In the build output is this error:

OctoPack cannot be run because NuGet packages were restored prior to the build running, and the targets file was unavailable when the build started. Please build the project again to include these packages in the build. You may also need to make sure that your build server does not delete packages prior to each build. For more information, see Improved Package Restore - .NET Blog

Hope this helps!

Paul

how can it be resolved ? That error message is coming due to this entry in cs.proj file…

Hi,

This occurs when the packages aren’t available during the build. It can be fixed using the following: http://docs.nuget.org/consume/package-restore/team-build

Hope that helps!

Dalmiro