NuGet Pack Fails with "Data at the root level is invalid. Line 1, position..."

Basically I get the following error in the build log from Teamcity.

[14:04:56]Step 4/4: NuGet Pack

[14:04:56][Step 4/4] pack: Create NuGet package from Api.nuspec

[14:04:56][pack] NuGet command: C:\TeamCity\buildAgent\tools\NuGet.CommandLine.2.0.40000.nupkg\tools\NuGet.exe pack C:\TeamCity\buildAgent\work\80b807d4abcbc4fd\Api.nuspec -OutputDirectory C:\TeamCity\buildAgent\work\80b807d4abcbc4fd\Build\Packages -BasePath C:\TeamCity\buildAgent\work\80b807d4abcbc4fd -Verbose -Version 2012.2012.01.18 -Properties Configuration=Release

[14:04:56][pack] Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script6838468774622441782.cmd

[14:04:56][pack] in directory: C:\TeamCity\buildAgent\work\80b807d4abcbc4fd

[14:04:56][pack] Attempting to build package from 'Api.nuspec'.

[14:04:56][pack] Data at the root level is invalid. Line 1, position 22.

[14:04:56][pack] Process exited with code 1

[14:04:56][Step 4/4] Step NuGet Pack failed

Prior to step 4 the library is built and has unit tests applied. The nuspec file which is being used is as follows;


?xml version="1.0"?>
        <title>Namadgi Social API</title>
        <authors>Namadgi Systems</authors>
        <owners>Namadgi Systems</owners>
        <copyright>Copyright Namadgi Systems 2012</copyright>
            <dependency id="Newtonsoft.Json" version="4.5.9" />
            <dependency id="twitterizer" version="" />
          <dependency id="twitterizer-streaming" version="" />
        <file src="SocialMedia\Namadgi.Api.SocialMedia\bin\Debug\Namadgi.Api.SocialMedia.dll" target="lib\net40\Namadgi.Api.SocialMedia.dll" />

Why is it throwing this error? The nuspec file is created from nuget.exe itself.
Comment actions Permalink

It looks like an error with XML formatting in your nuspec file.
Does it actually have spaces in the first line as displayed here?

Comment actions Permalink

No that appears to be some issue with pasteing it into the forum.


Please sign in to leave a comment.