I am trying to create a nuget package for a .csproj file but want the package name to be different from the csroj file (which it is by default) and I don't want to specify a .nuspec file. Is there a way of doing this? I can only see a version name override option on the command line options and not a package name override option.
I am doing this in TeamCity but this is besides the point. I am thinking I need to pass additional parameters to the NuGet pack command?
Thanks,
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.
Put simply, a NuGet package is a single ZIP file with the . nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number.
Nuget's Properties argument is what you're looking for.
Provided your .nuspec
file uses a placeholder then you can pass a value for it via the Properties argument. From the nuget docs:
Properties. Specifies a list of token=value pairs, separated by semicolons, where each occurrence of $token$ in the .nuspec file will be replaced with the given value. Values can be strings in quotation marks.
So nuget.exe -Properties id=someProject
will use "someProject" for any occurance of $id$
.
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