Questions tagged [nuget-spec]

NuGet spec is a command on the nuget executable. The command is used to generate a .nuspec file for a new package. This .nuspec file is used in the generation of Nuget packages. It can be used to specify meta data about the package, to define a package's dependencies, and to specify which files should be packaged.

spec command (NuGet CLI)

Applies to: package creation • Supported versions: all

Generates a .nuspec file for a new package. If run in the same folder as a project file (.csproj, .vbproj, .fsproj), spec creates a tokenized .nuspec file. For additional information, see Creating a Package.

Usage

nuget spec [<packageID>] [options]

where <packageID> is an optional package identifier to save in the .nuspec file.

Options

Option | Description

AssemblyPath | Specifies the path to the assembly to use for metadata.

Force | Overwrites any existing .nuspec file.

ForceEnglishOutput | (3.5+) Forces nuget.exe to run using an invariant, English-based culture.

Help | Displays help information for the command.

NonInteractive | Suppresses prompts for user input or confirmations.

Verbosity | Specifies the amount of detail displayed in the output: normal, quiet, detailed (2.5+).

Also see Environment variables

Examples

nuget spec

nuget spec MyPackage

nuget spec -a MyAssembly.dll
226 questions
7
votes
1 answer

Unable to pack a NuGet package using dotnet CLI and nuspec file

I have several projects that I'm migrating from .NET Framework 4.7 to .NET Standard 2.0. As a result, I'm trying to use the dotnet pack command to create my NuGet package while using my nuspec file with tokens. I have several custom build scripts…
tj-cappelletti
  • 1,774
  • 12
  • 19
7
votes
1 answer

How to change script or style files location from nuget?

I have a MVC project and I am using jquery, bootstrap and some other files from nuget. In mvc by default all of scripts files is in Scripts and all of css files is in Content as you know. I moved all scripts and css files to Content/css , Content/js…
7
votes
3 answers

Nuget pack does not honor number of digits on assembly version

I need nuget pack to generate a package version with only 3 digits (we want to do semantic versioning on it) but when I call it on a csproj which has an AssemblyVersion attribute set to "1.0.0", the resulting nupkg file ends with version "1.0.0.0"…
julealgon
  • 7,072
  • 3
  • 32
  • 77
7
votes
2 answers

Create a nuspec file that uses all the default behaviour but adding one additional file

I want to have a nuspec file that automatically reads all the info from packages.config and so on, building up all the dependencies, but also includes just one single additional file. Is there a way to do this? For example, here is a nuspec file…
joshcomley
  • 28,099
  • 24
  • 107
  • 147
6
votes
1 answer

Execute an action after my nuget package is installed

We have created a lot of NuGet packages. One of them is a tool, and it contains a special compiler and it is installed like a dotnet tool. The name of the command is "PolyGen". We used a similar mechanism to what Grpc.Tools uses, that means we have…
György Gulyás
  • 1,290
  • 11
  • 37
6
votes
1 answer

Setting file properties with NuGet using .targets file

I am building a project to be installed as a NuGet package and I want to set the properties of a SpecFlow feature file (because it is latest SpecFlow and should not produce code-behind files for the features.) To achieve the effect of selecting a…
Matt W
  • 11,753
  • 25
  • 118
  • 215
6
votes
1 answer

Nuget pack csproj using nuspec

I want to create a nuget package that contains only what is specified in my nuspec file, but still get the version from my csproj. In order to use the token I have to pack like: nuget pack MyProj.csproj But when I do it like this it adds some…
Daniel
  • 639
  • 8
  • 24
6
votes
1 answer

NuGet reference specification with an assembly not in lib subfolder

I have a fairly complex and large project that I want to attempt to package as a nuget package for internal use. I want to avoid copying files, because there are quite a few (150 MB+ of binaries). Instead, I am trying to point a package blueprint…
5
votes
2 answers

How to copy a text file from NuGet package during build of C# code that uses the package?

How do you copy a text file that has been included along with the DLLs within a NuGet package? When I use my custom NuGet package in another solution (c:\dev\ for this example), the resulting file structure within…
cezn
  • 81
  • 1
  • 5
5
votes
1 answer

Simplest way to target multiple framework in nuget?

I created a library that uses: generics, extension methods and Func delegate. Func delegate is most new feature to .NET (version 3.5) in the library. When I published it to nuget, the project was targeting the .NET version 4.5.2 but when I tried to…
mshwf
  • 7,009
  • 12
  • 59
  • 133
5
votes
1 answer

Nuget Package - Referenced Assemblies Are Not Being Included As Project References

Before I go into the problem, let me quickly explain my goal: I have a template project that I use for each website that I build, which includes base classes, common pages (e.g. contact us), useful utilities (exception logging), etc. I want to make…
5
votes
2 answers

Specify source in nuspec dependency

I have a local NuGet feed. This feed contains a dependency and that dependency is on nuget.org. This is in my nuspec file: How can I specify that NuGet has to look in…
Marnix
  • 6,384
  • 4
  • 43
  • 78
5
votes
5 answers

How can i make dll.config to be part of Nuget package

Since dll.config is not supported by .NET and while creating nuget packages dll.config are not part of the package. Is there a way that i can have dll.config as part of the nuget package? If someone consumes my nuget package they should get both the…
StackOverflowVeryHelpful
  • 2,347
  • 8
  • 34
  • 46
4
votes
0 answers

How can I keep NuGet from including dependent binaries?

I have a project that depends on another nuget package that drops native binaries into the bin directory of my project. I need to create a Nuget spec to package up my binaries. The simple method MY ID
Eric Brown
  • 13,774
  • 7
  • 30
  • 71
4
votes
1 answer

Create Nuget Package with binary Content Files - is this possible?

I try to create a nuget package with a binary file in the contentFiles folder. Unfortunately when I try to restore I get an error message saying the file is a binary file not ascii text. Is there some way to add binary files to the ContentFiles…
user5855178
  • 567
  • 1
  • 7
  • 17
1
2
3
15 16