Reputation: 16239
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'.
Upvotes: 10
Views: 19407
Reputation: 25178
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
Upvotes: 0
Reputation: 41
nuget pack MYPROJECT.csproj
change the .nupkg file extension to .zip.
Open the zip you will see the .nuspec file.
Upvotes: 1
Reputation:
navigate to the directory you want to create the file
download this nuget exe in the directory
cd to the directory on command line
use the command "nuget spec project.csproj"
check your directory for the generated nuspec file
Upvotes: 2
Reputation: 20322
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.
Upvotes: 12