C# VS_PACKAGE_REFERENCES issue

Hi there, I have some issues while setting “VS_PACKAGE_REFERENCES” in CMake file for a C# project. The issue is that I need to reference a nuget package. And I’m writting
“set_property(TARGET SampleApp PROPERTY VS_PACKAGE_REFERENCES “Microsoft.Windows.SDK.Contracts_10.0.22621.2428”)” in the CMake file. Then when I tried building it in the command line, I found that the reference is not added to the project (though it was added in .csproj). I also tried to build it inside the Visual Studio, it worked well for me. The question is why this is not added in the command line build.

Could someone please help me?

Do you mean “not a Visual Studio generator” when you say “in the command line”? If so, the VS_* properties are only effective for the Visual Studio generator.