I try to make a NuGet package from a .NET 4.7.2 class library (VS2017), but the resulting NuGet package surprisingly shows no dependencies (which is an error).
My setup is like this:
- My class library is .NET Framework 4.7.2
- My class library uses another NuGet package (that has dependencies).
- My class library uses packageReferences in .csproj
- My class library contains a proper .nuspec file
- I use nuget.exe pack for creating the package
The nuget.exe pack command should automatically fill in the needed dependencies - this also used to be the case earlier (in another project). However, at that time I used packages.config instead of packageReferences with my class library. Does that change anything?
What is going on?
How can I force the system to again include the needed dependencies in my package?
Notes:
The package is built by a MSBuild script on our TeamCity build server (without VS2017). It's the build script that calls both "nuget.exe restore" and later "nuget.exe pack" as part of its build logic.
MSBuild is version 15.7
nuget.exe is version 4.6.2
1> ***** Insert dependencies into nuspec file: 'Prog.nuspec' 1> Exception when calling "Load" with" 1 " arguments: "".", hexadecimal value 0x00, is an invalid sign., line 2, position 1."D:\Prog\NuGetPackDependencies.ps1:4 знак:3 1> + $doc.Load((Resolve-Path $xmlfile)) 1> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1> + CategoryInfo : NotSpecified: (:) [], MethodInvocationException 1> + FullyQualifiedErrorId : DotNetMethodException 1> ***** Finished script
– Weanling