NuGet product used: VS UI
NuGet version: 4.6.2.5055
VS version: VS2017 Professional v15.6.7
OS version: win10 v1607 (14393.2665)
I am trying to move a common package which is used by multiple VC++ projects in a solution to a common solution level packages.config. But it doesn't seem to work. I can't use https://github.com/Microsoft/MSBuildSdks/tree/master/src/CentralPackageVersions since VC++ projects still don't support Package References. Is there any solution for this issue or any workaround that would work?
Please vote on this dev feedback issue for C++team: https://developercommunity.visualstudio.com/idea/351636/use-packagereference-in-vcxproj.html
If you want to leave a comment saying why it is important for you, please do.
Hi, I have a working sample for using Nerdbank.GitVersioning with C++ PackageReferences at
https://github.com/japj/CppWithNuGetPackageReference
It works by using the _NuGetTargetFallbackMoniker property used by the official NuGet targets.
MSBuild /t:Restore and build works correctly with this in C++ projects.
However this is with a msbuild “build” nuget package, not tried with any other types yet (e.g. if you want to consume any other assets from the nuget)
Perhaps you can use this also in combination with CentralPackageVersions.
The biggest issue though is that the VS Manage NuGet UI does not understand PackageReferences for vcxproj yet, so although restore and build work ok, you need to workaround some hoops for actually adding packages with the UI.
Most helpful comment
Hi, I have a working sample for using Nerdbank.GitVersioning with C++ PackageReferences at
https://github.com/japj/CppWithNuGetPackageReference
It works by using the _NuGetTargetFallbackMoniker property used by the official NuGet targets.
MSBuild /t:Restore and build works correctly with this in C++ projects.
However this is with a msbuild “build” nuget package, not tried with any other types yet (e.g. if you want to consume any other assets from the nuget)
Perhaps you can use this also in combination with CentralPackageVersions.
The biggest issue though is that the VS Manage NuGet UI does not understand PackageReferences for vcxproj yet, so although restore and build work ok, you need to workaround some hoops for actually adding packages with the UI.