CSharp: Generate nupkg from command line

Dear all,

I have a simple cmakelists.txt project:

project(Example VERSION 0.1.0 LANGUAGES CSharp)
add_library(foo SHARED bar.cs)

I understand I can open Visual Studio 2019, go to project, and click “Pack” to generate my “foo.1.0.0.nupkg” nuget package:


I’d like to achieve the same step from the command line. How should I do that in cmake ?

Thanks !

If there’s an MSBuild target, you can access it via cmake --build . -- -MSBuildFlag. Otherwise, that does not look like a target CMake would know about to me.

1 Like