how to create nuspec file in specific folder?

Neo picture Neo · Jun 18, 2015 · Viewed 8k times · Source

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'.

Answer

Kiliman picture Kiliman · Jun 18, 2015

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.