Home: Nuget pack does can't find build output in BasePath

Created on 4 Nov 2016  路  5Comments  路  Source: NuGet/Home

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): Nuget.exe

NuGet version (x.x.x.xxx): 3.4.4-rtm

OS version (i.e. win10 v1607 (14393.321)): win7

Worked before? If so, with which NuGet version: Don't know

Detailed repro steps so we can see the same problem

  1. Build a console application (.\src\Project\Project.csproj) to a directory other than the OutputPath in the csproj like .output\_Build

  2. Execute NuGet.exe pack -Version "0.1.0" -BasePath ".\.output\_Build" -OutputDirectory ".\.output\Packages\NuGet" ".\src\Project\Project.csproj" -Symbols -verbosity detailed -tool

  3. Exception occurs: Unable to find 'c:\project\src.out\Debug\Project.exe'.

Looks like nuget pack is using the directory specified in the csproj instead of the BasePath parameter to look for the output.

Verbose Logs

Attempting to build package from 'Project.csproj'.
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
NuGet.CommandLineException: Unable to find 'c:\project\src.out\Debug\Project.exe'. Make sure the project has been built.
at NuGet.CommandLine.ProjectFactory.BuildProject()
at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath)
at NuGet.CommandLine.PackCommand.BuildFromProjectFile(String path)
at NuGet.CommandLine.PackCommand.BuildPackage(String path)
at NuGet.CommandLine.PackCommand.ExecuteCommand()
at NuGet.CommandLine.Command.ExecuteCommandAsync()
at NuGet.CommandLine.Command.Execute()
at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)

Pack Question

Most helpful comment

@aateeque the BasePath is to tell nuget where to look for files listed in the nuspec file you use to create the nupkg. For a given BasePath, you can list all your files in the nuspec relative to your BasePath. Does that make sense?

All 5 comments

@aateeque can you try the latest version of nuget.exe here: https://dist.nuget.org/win-x86-commandline/v3.5.0/NuGet.exe

@emgarten just tried with 3.5.0.1938 and see the same error. The BasePath is to tell nuget where to look for build output, right?

@emgarten any idea about this one? Am I using BasePath correctly?

I think BasePath is related to the Files element in the nuspec, not the project.

The base path of the files defined in the nuspec file.

@aateeque the BasePath is to tell nuget where to look for files listed in the nuspec file you use to create the nupkg. For a given BasePath, you can list all your files in the nuspec relative to your BasePath. Does that make sense?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dotMorten picture dotMorten  路  3Comments

skofman1 picture skofman1  路  3Comments

infin8x picture infin8x  路  3Comments

philippe-lavoie picture philippe-lavoie  路  3Comments

livarcocc picture livarcocc  路  3Comments