1

Closed

nuget.exe adding the files through <files> and -symbols gives bad error message

description

I'm creating a package through nuget.exe with -symbols option and I have this in .nuspec :

<files>
<file src="**\*.vb" target="src" />
</files>

I get the error "Cannot create a package that has no dependencies nor content." which is hard to decipher.

Example:

C:\Users\aldion\Documents\Visual Studio 2010\Projects\WebApplication6\ClassLibra
ry1>nuget pack -build -symbols
Attempting to build package from 'ClassLibrary1.nuspec'.
Cannot create a package that has no dependencies nor content.

the issue here is that I'm using a nuspec file and the project isn't built. we could use a better error message.

file attachments

Closed Aug 17 at 3:32 PM by JeffHandley

comments

dfowler wrote Jun 7, 2011 at 8:36 AM

Can you attach a full repro?

aldion wrote Jun 7, 2011 at 8:29 PM

attaching minimal repro, unzip and run "nuget.exe pack -build -symbols"
if you remove
<file src="***.vb" target="src" />
from classlibrary1.nuspec it won't fail.

andy78smith wrote Jun 24, 2011 at 5:25 PM

Had similar problem - I get the error "Cannot create a package that has no dependencies nor content."

I had to add a dummy <frameworkAssemblies> element in the following .nuspec file before it would work:

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>My.Package</id>
<version>1.0.0.0</version>
<authors>Blah</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Blah</description>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System" targetFramework="net40" />
 </frameworkAssemblies>
</metadata>
<files>
<file src="..\MyOutputDir\bin\**" target="lib" />
</files>
</package>

andy78smith wrote Jun 24, 2011 at 5:38 PM

Ignore my comment. It "fixes" the error, but package contains no content. Something else going on :/

pranavkm wrote Jul 7, 2011 at 12:28 AM

For -Symbols to work, you point nuget to a nuspec file that includes both sources and binaries. The Symbols flag causes the pack command to create two packages - selectively removing files under src and pdb files when creating the lib package and removing content and powershell script when generating the symbols package. With the nuspec that is specified in the repro as well as the one specified by andy78smith, one of those packages would have no content. The right way to do this would be:-
to have a files collection such as
<files>
<file src="***.dll;***.pdb" target="lib" />
<file src="***.vb" target="src" />
</files>

aldion wrote Jul 8, 2011 at 1:00 PM

Actually what seems wrong is that I get a different behavior in VB than C#.

I created a default C# class and have the equivalent nuspec :
<files>
<file src="***.cs" target="src" />
</files>

And I can do :
pack -build -symbols
Attempting to build package from 'Test1163.csproj'.
Building project for target framework '.NETFramework,Version=v4.0'.
Packing files from 'C:\Users\aldion\Documents\Visual Studio 2010\Projects\Test11
63\Test1163\bin\Debug'.
Using 'Test1163.nuspec' for metadata.
Successfully created package 'C:\Users\aldion\Documents\Visual Studio 2010\Proje
cts\Test1163\Test1163\Test1163.1.0.nupkg'.

Attempting to build symbols package for 'Test1163.csproj'.
Building project for target framework '.NETFramework,Version=v4.0'.
Packing files from 'C:\Users\aldion\Documents\Visual Studio 2010\Projects\Test11
63\Test1163\bin\Debug'.
Using 'Test1163.nuspec' for metadata.
Successfully created package 'C:\Users\aldion\Documents\Visual Studio 2010\Proje
cts\Test1163\Test1163\Test1163.1.0.symbols.nupkg'.


while my default vb class with nuspec (the repro project) has :
<files>
<file src="**\*.vb" target="src" />
</files>

When I try to pack I get an error:
nuget pack -build -symbols
Attempting to build package from 'ClassLibrary1.nuspec'.
Cannot create a package that has no dependencies nor content.

aldion wrote Jul 13, 2011 at 11:13 PM

Closing.
  • Pranav is correct, the repro only has a .nuspec file and no vbproj which is required to build for -symbols. I got confused with "nuget pack -build", in this case the -build is ignored since we use the nuspec file (I thought it was building).
** Closed by aldion 07/13/2011 4:13PM

aldion wrote Jul 13, 2011 at 11:21 PM

the original bug still stands, the error message is vague and could be improved.
currently : if -symbols is used and the project isn't built it says : "Cannot create a package that has no dependencies nor content.", it woud be better to mention that the project needs to be built...

pranavkm wrote Jul 18, 2011 at 6:22 PM

Fixed in changeset 7c91ded67054

feiling wrote Jan 6 at 11:24 PM

Fixed in changeset 6226d152f3a2857d702d411596f6e29f412aec84