Closed wgnf closed 2 years ago
To download a NuGet Package maybe use this command:
dotnet add package <NAME> -v -n --prerelease -f <TARGET FRAMEWORK> --package-directory <PACKAGE_DIRECTORY>
On a dummy project and use PACKAGE_DIRECTORY
as a point to refer to the downloaded package
More information see here
But what's with a possible nuget.config
?
For that I might need to add this dummy project in the actual source structure...
But I also want to be non-invasive 🤔
OH!
Maybe dotnet restore --packages <PACKAGE_DIRECTORY>
might work?
This'll definitely utilize everything that there is (nuget.config
, cached packages on the system, ...) and will be offered for the .NET (Core) CLI
Does this work non-SDK-Style projects too?
Yes, dotnet restore
works. Following needs to be done for downloading packages:
nuget restore -Force -OutputDirectory <FOLDER> -Recursive
dotnet restore --packages <FOLDER> --force /p:DisableImplicitNuGetFallbackFolder=true
There are some catches, though:
dotnet restore
: Package-Name (lower-case) --> Version --> All data (nupkg
, nuspec
, license
, ...)nuget restore
: Package-Name + Version (i.e. Autofac.4.9.4
) --> Some data (nupkg
, license
, ...)Getting the License-Text should also be "two-stepped"
Getting the License-Type should be done, by:
Yes,
dotnet restore
works. Following needs to be done for downloading packages:
- Non-SDK-Style:
nuget restore -Force -OutputDirectory <FOLDER> -Recursive
- SDK-Style:
dotnet restore --packages <FOLDER> --force /p:DisableImplicitNuGetFallbackFolder=true
There are some catches, though:
- Structure:
dotnet restore
: Package-Name (lower-case) --> Version --> All data (nupkg
,nuspec
,license
, ...)nuget restore
: Package-Name + Version (i.e.Autofac.4.9.4
) --> Some data (nupkg
,license
, ...)
Problem with using restore
is just that every package will be downloaded, even though we might just need a few, depending on the cache (see #1) and additionally restore might take pretty long in some cases (idk why)
Maybe looking for the package in the package file-package-sources
And then downloading directly might be a better option
Or really just using dotnet add
or something on a dummy project (inside the obj
folder maybe) for packages that are really needed might be the better option
Maybe there's a package that can do this? 🤔
These are the ways licenses can be specified (as far as i found out so far) - information are in the .nuspec
file:
1:
license
tag with file
attribute (/package/metadata/license[@file]
)2:
license
tag with expression
attribute (/package/metadata/license[@expression]
)licenseUrl
tag (/package/metadata/licenseUrl
)licenseUrl
tag)license
tag3:
license
tag with expression
attribute (/package/metadata/license[@expression]
)licenseUrl
tag (/package/metadata/licenseUrl
)license
tag4:
licenseUrl
tag (/package/metadata/licenseUrl
)license
taglicenseUrl
tag)5:
licenseUrl
tag (/package/metadata/licenseUrl
)license
tagBest way to do it would be to have a number of sources:
... so that we get more and more information with each step/source, until we eventually, hopefully, have everything that we need
Other TODOs:
PackageReference
to have a LicenseInformation
object? 🤔 dotnet package list
also provides ProjectReferences
which cannot be downloaded... this needs to be fixed
idk how this might work, i know of these locations where Licenses might be:
PackageLicenseExpression
PackageLicenseUrl