I have a simple compiled library (compiled with very different TFs) that I want to provide for consumers via nugets.
For this purpose I want to use nuget spec -a {libraryPath} command to create nuspec (and then nuget pack to create an actual nuget).
Apperently nuget spec command (version without arguments and with -a) doesn't generate a valid/filled nuspec file and instead always creates just an empty template.
So I have 2 questions:
What's the difference between
nuget specandnuget spec -a {libraryPath}? As I understand in both of cases, the only generated output is empty nuspec file?Sometimes
nuget spec -a {libraryPath}works well, but in some cases it throws error like:c:\test>nuget spec -a ConsoleApp1.dll Could not load file or assembly 'file:///c:\test\ConsoleApp1.dll' or one of its dependencies. The system cannot find the file specified.
where ConsoleApp1.dll is output from consoleapp project with <TargetFramework>net6.0</TargetFramework>:
or:
c:\test>nuget spec -a SuperTest1.dll
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=..' or one of its dependencies. The system cannot find the file specified.
where SuperTest.dll is output from classlibrary project (empty) with <TargetFramework>netcoreapp3.1</TargetFramework>
How to fix such errors?
UPDATE1:
sounds like I also have to create a structure like:
lib
--> net452 --> library1.dll
--> netcoreapp3.1 --> library1.dll
...
and then run it from the root folder:
nuget spec -a .\lib\net452\Library.dll
nuget pack
to be able to see the library in consumers.
dotnet packand the package will automatically be created with all the project's target frameworks.NuGet/Homeissue 12736 says it all.dotnet pack) based on a temporary project. However it produces some noize in particular related to the fact that temporary project binary appeared in the consumer's project file (for Non-SDK projects). So I hoped I can create package that can be consumed for applications in old and modern TFs based on initial binary.nuget spec -adoes exactly this, but appererntly not in all cases. Do you have any other suggestions how to do it?