NuGet Package: The specified path, file name, or both are too long.
Hi,
I'm trying TeamCity for the first time and got a build pipeline set up which works fine so far. I now wanted to add a step to create a nuget package but I'm running into the error below:
[pack] NuGet command: C:\TeamCity\buildAgent\tools\NuGet.CommandLine.4.3.0\tools\NuGet.exe pack C:\TeamCity\buildAgent\work\f7bca5d57d919c87\demoproject.charlie.nuspec -OutputDirectory C:\TeamCity\buildAgent\work\f7bca5d57d919c87\build\packages -Properties Configuration=Release
[13:54:26][pack] Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script5717886013603880617.cmd
[13:54:26][pack] in directory: C:\TeamCity\buildAgent\work\f7bca5d57d919c87
[13:54:26][pack] Attempting to build package from 'demoproject.charlie.nuspec'.
[13:56:21][pack] The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
[13:56:22][pack] Process exited with code 1
[13:56:22][pack] Process exited with code 1
[13:56:22][Step 4/4] Step Create NuGet Package (NuGet Pack) failed
My nuspec file is fairly basic as I just want to see if I can get the package created:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- Required elements-->
<id>demoproject.charlie</id>
<version>1.0.9</version>
<description>Demoproject charlie project</description>
<authors>The author</authors>
<!-- Optional elements -->
<!-- ... -->
</metadata>
<!-- Optional 'files' node -->
</package>
Does anyone have suggestions on how to fix this issue or what could be the cause of it?
Thanks
Ben
Please sign in to leave a comment.
It seems the issue was not specifying files to bundle so NuGet was trying to package everything it could find in the build folder. As there were some deeply nested paths it threw the above error.
If you are still having troubles with long file names, use Long Path tool to solve this problem.
I have used LongPathTool to solve the issue. Please Try
I would like to suggest you, try LongPathTool program to resolve this issue.
This tool is very helpful to resolve the issue.