Open anangaur opened 6 years ago
cc @rohit21agrawal
I'm Paulo.
@paulomorgado does the newtonsoft.json nupkg exist in the solution packages folder on disk?
As far as I can tell, yes. It's where the project itself picking it for referencing.
This is happening with version 4.1.0.2450 of nuget.exe.
If you point me to the commit for this version, I could try to debug it.
As far as I can tell, yes! But NuGet.exe is not telling me where it's looking for it.
I've tried with the latest version (nuget.exe 4.5.1) and the issue seems to have been resolved.
Nevertheless, when I choose verbosity detailed, the error message should mention the full path of what's looking for.
OOPS! Looks like it's back with 4.5.1.
The detailed output is:
Found packages.config. Using packages listed as dependencies
Unable to find 'Newtonsoft.Json.10.0.3.nupkg'. Make sure the project has been built.
NuGet.CommandLine.CommandLineException: Unable to find 'Newtonsoft.Json.10.0.3.nupkg'. Make sure the project has been built.
at NuGet.CommandLine.ProjectFactory.AddDependencies(Dictionary`2 packagesAndDependencies)
at NuGet.CommandLine.ProjectFactory.RecursivelyApply(Action`1 action, Object alreadyAppliedProjects)
at NuGet.CommandLine.ProjectFactory.RecursivelyApply(Action`1 action)
at NuGet.CommandLine.ProjectFactory.ProcessDependencies(PackageBuilder builder)
at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)
at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(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)
I tried using ProcMon to get where nuget.exe is trying to retrieve 'Newtonsoft.Json.10.0.3.nupkg' from and there's no mention of it in the capture.
nuget.exe tries to access "
Is there anything else I can look at?
@rohit21agrawal will setting the NUGET_PACKAGES env variable explicitly help? Does pack respect the env variable or command line option to state where the packages are?
Nope!
NuGet Version: 4.5.1.4879
Attempting to build package from '<project>.csproj'.
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin\amd64'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Packing files from '<build dir>\output\GateCommon\Release'.
Using '<package>.nuspec' for metadata.
Add file '<build dir>\<project>\Release\VisionBox.Gate.GateCommon.dll' to package as 'lib\net462\VisionBox.Gate.GateCommon.dll'
Found packages.config. Using packages listed as dependencies
Unable to find 'EntityFramework.6.1.3.nupkg'. Make sure the project has been built.
NuGet.CommandLine.CommandLineException: Unable to find 'EntityFramework.6.1.3.nupkg'. Make sure the project has been built.
at NuGet.CommandLine.ProjectFactory.AddDependencies(Dictionary`2 packagesAndDependencies)
at NuGet.CommandLine.ProjectFactory.RecursivelyApply(Action`1 action, Object alreadyAppliedProjects)
at NuGet.CommandLine.ProjectFactory.RecursivelyApply(Action`1 action)
at NuGet.CommandLine.ProjectFactory.ProcessDependencies(PackageBuilder builder)
at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)
at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(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)
Contents of NUGET_PACKAGES
:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2/23/2018 9:36 AM EntityFramework.6.1.3
d---- 2/23/2018 9:36 AM Newtonsoft.Json.10.0.3
d---- 2/23/2018 9:36 AM Newtonsoft.Json.9.0.1
d---- 2/23/2018 9:36 AM protobuf-net.2.3.3
d---- 2/23/2018 9:36 AM RabbitMQ.Client.4.1.3
d---- 2/23/2018 9:36 AM System.Runtime.Numerics.4.3.0
...
After making a custom build with more detailed logging, I found out that NuGet.exe is trying to find the packages in \<solution dir>\src instead of \<solution dir> even when NUGET_PACKAGES is set to \<solution dir>.
Why? I don't know!
is there a repro project/solution you can attach for us to investigate this?
I'm afraid I can't.
I'll try adding more logging to find out where nuget.exe is loosing the correct solution dir.
Running from \<solution dir>, NuGet.Commands.PackCommandRunner.BuildFromProjectFile is being called with \<solution dir>\src\<project dir>\<project file> for path. NuGet.CommandLine.ProjectFactory.CreateBuilder is being called with null for basePath.
Found the source of the problem. There's a solution in the
Can you pass -Properties SolutionDir= <actual solution dir>
from the command line?
The only difference was that I had this warning:
WARNING: NU5114: 'SolutionDir' key already exists in Properties collection. Overriding value.
But it's still not looking into that folder.
If I remove all .sln
files in subfolders, NuGet pack
works just fine.
From Paulo on mail:
I have a project that has a dependency on Newtonsoft.Json version 10.0.3 and compiles just fine.
However, nuget pack throws this error:
Found packages.config. Using packages listed as dependencies NuGet.CommandLine.CommandLineException: Unable to find 'Newtonsoft.Json.10.0.3.nupkg'. Make sure the project has been built. at NuGet.CommandLine.ProjectFactory.AddDependencies(Dictionary`2 packagesAndDependencies) at NuGet.CommandLine.ProjectFactory.ProcessDependencies(PackageBuilder builder) at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder) at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(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)
This also happens with other projects.
What am I missing?