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"?> <package> <metadata> <version>0.00</version> <title>Namadgi Social API</title> <authors>Namadgi Systems</authors> <id>NamadgiSocialAPI</id> <owners>Namadgi Systems</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Empty</description> <language>en-AU</language> <copyright>Copyright Namadgi Systems 2012</copyright> <dependencies> <dependency id="Newtonsoft.Json" version="4.5.9" /> <dependency id="twitterizer" version="2.4.1.1" /> <dependency id="twitterizer-streaming" version="2.4.0.26649" /> </dependencies> </metadata> <files> <file src="SocialMedia\Namadgi.Api.SocialMedia\bin\Debug\Namadgi.Api.SocialMedia.dll" target="lib\net40\Namadgi.Api.SocialMedia.dll" /> </files> </package>
Why is it throwing this error? The nuspec file is created from nuget.exe itself.
Please sign in to leave a comment.
It looks like an error with XML formatting in your nuspec file.
Does it actually have spaces in the first line as displayed here?
No that appears to be some issue with pasteing it into the forum.