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
Build a console application (.\src\Project\Project.csproj) to a directory other than the OutputPath in the csproj like .output\_Build
Execute NuGet.exe pack -Version "0.1.0" -BasePath ".\.output\_Build" -OutputDirectory ".\.output\Packages\NuGet" ".\src\Project\Project.csproj" -Symbols -verbosity detailed -tool
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.
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)
@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?
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?