Psake Console nuget issues

I have a psake script that calls msbuild like so:

Exec { msbuild $SolutionFile “/p:Configuration=$buildConfiguration;Platform=$buildPlatform;OutDir=$temporaryOutputDirectory;RunOctopack=true” }

I used this on the same solution, and it packages up a web api and web project no problems. I added a Console Application and I am seeing this error:

“E:\TFS\ProjectName\CompanyName.ProjectName.sln” (default target) (1) ->
“E:\TFS\ProjectName\CompanyName.ProjectName.Migrations\CompanyName.ProjectName.Migrations.csproj” (default target) (10) ->
(OctoPack target) ->
MSBUILD : OctoPack error OCTONUGET: Cannot create a package that has no dependencies nor content. [E:\TFS\ProjectName\CompanyName.ProjectName.Migrations\CompanyName.ProjectName.
Migrations.csproj]
MSBUILD : OctoPack error OCT-1805672349: There was an error calling NuGet. Please see the output above for more details. Command line: ‘E:\TFS\ProjectName\packages\OctoPack.3.
0.71\tools\NuGet.exe’ pack “E:\TFS\ProjectName\CompanyName.ProjectName.Migrations\obj\octopacking\CompanyName.ProjectName.Migrations.nuspec” -NoPackageAnalysis -BasePath “E:\TFS
ProjectName\CompanyName.ProjectName.Migrations” -OutputDirectory “E:\TFS\ProjectName\CompanyName.ProjectName.Migrations\obj\octopacked” -Version 1.0.0.0 [E:\TFS\ProjectName\CompanyN
ame.ProjectName.Migrations\CompanyName.ProjectName.Migrations.csproj]
MSBUILD : OctoPack error OCT-1805672349: System.Exception: There was an error calling NuGet. Please see the output above for more details. Command line: ‘E:\TFS\ProjectName\pa
ckages\OctoPack.3.0.71\tools\NuGet.exe’ pack “E:\TFS\ProjectName\CompanyName.ProjectName.Migrations\obj\octopacking\CompanyName.ProjectName.Migrations.nuspec” -NoPackageAnalysis
-BasePath “E:\TFS\ProjectName\CompanyName.ProjectName.Migrations” -OutputDirectory “E:\TFS\ProjectName\CompanyName.ProjectName.Migrations\obj\octopacked” -Version 1.0.0.0 [E:\TFS\R
oomieStop\CompanyName.ProjectName.Migrations\CompanyName.ProjectName.Migrations.csproj]
MSBUILD : OctoPack error OCT-1805672349: at OctoPack.Tasks.CreateOctoPackPackage.RunNuGet(String specFilePath, String octopacking, String octopacked, String projectDirectory
) in d:\TeamCity\buildAgent\work\1f6ae101e1fcba62\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 588 [E:\TFS\ProjectName\CompanyName.ProjectName.Migrations\CompanyName.Roomi
eStop.Migrations.csproj]
MSBUILD : OctoPack error OCT-1805672349: at OctoPack.Tasks.CreateOctoPackPackage.Execute() in d:\TeamCity\buildAgent\work\1f6ae101e1fcba62\source\OctoPack.Tasks\CreateOctoPa
ckPackage.cs:line 202 [E:\TFS\ProjectName\CompanyName.ProjectName.Migrations\CompanyName.ProjectName.Migrations.csproj]

0 Warning(s)
3 Error(s)

Time Elapsed 00:00:03.59
Error: 8/4/2016 3:25:51 PM:
At E:\TFS\ProjectName\Packages\psake.4.6.0\tools\psake.psm1:156 char:17 + throw ("Exec: " + $errorMessage) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<
==>>] Exception: Exec: Error executing command msbuild $SolutionFile “/p:Configuration=$buildConfiguration;Platform=$buildPlatform;OutDir=$temporaryOutputDirectory;RunOctopack
=true” .
Build exit code: 1

PS E:\TFS\ProjectName\CompanyName.ProjectName.Build>

I added a nuspec file, but that doesn’t seem to fix anything on the Console application causing these issues with nuget. Do I need to do something to get this to work?

HI Joseph,

Thanks for reaching out. If you try the same command outside of psake (just running msbuild manually), does it work? if that doesn’t work, can you try running the same MSBuild command without the Octopack parameters?

Regards,
Dalmiro

It works out of the box without the Octopack references on calling the msbuild command from psake. I do not have a custom MSBuild target setup for the console app yet.

I had to setup a nuspec file in the console application with the Ocotpack reference there for it to get a clean msbuild to work. I did not have to do this out of the box with psake on a web project or a web api project and they at least built without error(even though the artifacts may not be completely setup).

The video on doing a database deployment which is presented with a console application does not go over any of this, and I did not see them creating the build process to see how they are building up their console application artifacts.


Hi Joseph,

Could you send us the content of the file E:\TFS\ProjectName\CompanyName.ProjectName.Migrations\obj\octopacking\CompanyName.ProjectName.Migrations.nuspec. I’d like to see if it has any file reference on it.

Thanks,
Dalmiro

Here is the nuspec file for the console application. If I do not declare the dependencies like so, it will not build with msbuild out of the box. There are currently no build artifacts being packaged in the nuget file though when I call msbuild on the octopacked application.

Do I need to specify msbuild targets for a brand new console application? I would have thought the artifacts/executable would be built out of the box. The other thing is, despite which dependency I declare, I only have to declare a single one for it to “build” via psake/msbuild command, which I thought was odd considering the other projects(Web and WebAPI) would generate a nuspec file out of the box .

<?xml version="1.0"?> CompanyName.ProjectName.Migrations 1.0.0.0 Joseph Joseph http://example.com http://example.com false The CompanyName.ProjectName.Migrations deployment package, built on 8/4/2016

Hi Joseph,

So the initial error was: Cannot create a package that has no dependencies nor content. . This error shows up when Nuget doesn’t find any <file> references in the nuspec file when attempting to create a package. For this reason I asked you to show me that nuspec file, to confirm it didn’t had any <file> references in it.

We ran through this ticket along with 2 of my teammates, and all we could think of was that perhaps the output of your MSBuild build is being dropped somplace else where the Nuget pack process executed by Octopack can’t see/reach it.

Do you think you could add a Pre and Post build event to your project with the script cd just so we can see where is the MSBuild process being executed from? See attached screenshot as reference

That might give us a hint of where is MSBuild executing from vs where are your binaries being dropped vs where is Nuget.exe expecting for the files to be.

Thanks!
Dalmiro

Notice:

This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.