NuGet Package Ignore -Pair Arguments When Specified -Build

I am trying to install NuGet using a script. I have the following command for actual deployment:

nuget pack MyProjection.csproj -Build -Properties Configuration=Release 

For the examples presented on the NuGet website, this is the correct command line. I noticed that some examples say -Prop and not -Properties , but I don't think that matters.

However, the output of NuGet:

 Attempting to build package from 'MyProject.csproj'. Building project for target framework '.NETFramework,Version=v4.0'. Packing files from 'C:\Users\...\MyProjection\bin\Debug'. Using 'MyProject.nuspec' for metadata. Successfully created package 'C:\Users\...\MyProject\MyProject.2.2.0.0.nupkg'. 

Please note that this is packing the files in the Debug folder instead of the Release folder!

If I remove the -Build , it captures the files from Release as intended. First question: did I publish debug versions of my project? Second question: how can I use these two command arguments?

If I need, I will create a project using MSBuild.

+4
source share
1 answer

When packing a project, nuget will use the current project settings, ignoring the configuration parameter passed from the command line. The same can be said for the basepath argument.

If you change the default configuration for the release, nuget will build your package using the release bit. Find the following in your .csproj:

  <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 

And change it to:

  <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration> 
+4
source

All Articles