how to create nuspec file in specific folder?

17.1k views Asked by At

I tried to create .nuspec file in a different folder by giving path but it is giving me error

Nuget.exe spec ..\MYDEMOFOLDER
Nuget.exe pack ..\MYDEMOFOLDER\MYPROJECT.csproj
pause

want to create MYPROJECT.nuspec in ..\MYDEMOFOLDER folder location

getting error to create nuspec file 
The package ID '..\MYDEMOFOLDER' contains invalid characters. Examples of valid package IDs in
clude 'MyPackage' and 'MyPackage.Sample'.
4

There are 4 answers

0
Kiliman On BEST ANSWER

Unfortunately nuget.exe spec doesn't work like that. It expects a package ID.

If you need to create a nuspec in a given folder, you will need to change to that directory.

pushd ..\MYDEMOFOLDER          // switch to new directory (remember current)
nuget spec MYPROJECT           // create MYPROJECT.nuspec file
nuget pack MYPROJECT.csproj    // pack MYPROJECT.csproj
popd                           // return to previous directory

NOTE: If you're going to pack a project file, you don't need to create a nuspec file, as nuget will create one automatically.

0
AudioBubble On
  1. navigate to the directory you want to create the file

  2. download this nuget exe in the directory

  3. cd to the directory on command line

  4. use the command "nuget spec project.csproj"

  5. check your directory for the generated nuspec file

0
Devanshu agarwal On
  1. Generate .nupkg file using below command

nuget pack MYPROJECT.csproj

  1. change the .nupkg file extension to .zip.

  2. Open the zip you will see the .nuspec file.

0
Tomas Kubes On

Dotnet has quite confusing similar arguments

--output

is used for output for build = input for nuget pack

/p:OutputPath=

is used as output folder of nuget pack itself

Example:

dotnet pack -c Release -p:PackageVersion=1.2.3 YourProject.csproj --no-build --output c:\outputofbuild  /p:OutputPath=c:\outputfornuget