I'd like to create a nuget package (from some c# project), but I don't want to embed the generated dll, but just some static files instead.
I added a tag at the end of my nuspec file, but nuget pack command continues to embed the project.dll in the package. The thing is I don't want this dll to be published.
Is there any way to do that?
Thanks,
Régis
on the toolbar of the Assembly Explorer window or choose File | Open from NuGet Packages Cache in the main menu . This will open the Open from NuGet Packages Cache dialog. The dialog lists packages from all NuGet cache locations on your machine. Use the search field in the dialog to find the desired package.
A . nuspec file is an XML manifest that contains package metadata. This manifest is used both to build the package and to provide information to consumers. The manifest is always included in a package.
Yes. You can create a .nuspec file that simply references the content files.
You must use nuget pack MyPackage.nuspec
Don't pack the .csproj file as that causes NuGet to include the built assembly.
See http://docs.nuget.org/create/nuspec reference for more info.
To package a file as content, you must use target=content
when listing the file in your .nuspec document.
To create a 'content only' nuget package, you must use a <files>
node to list the files.
A <files>
node must be a sibling of the <metadata>
node.
A <file>
node must be a child of a <files>
node.
To include a file as content, set the target attribute in a <file>
node to 'content'.
Example:
<files>
<file src="{filePath}" target="content"/>
</files>
As previously mentioned, you must then pack the .nuspec file rather than a .csproj file:
nuget pack *.nuspec
I found the target=content
trick here:
https://docs.microsoft.com/en-us/nuget/reference/nuspec#including-content-files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With