The wait is over. NuGet support for C++ projects is here.
Quick Links• NuGet 2.5 Download page: https://nuget.codeplex.com/releases/view/96733• CoApp’s Powershell Tools Installer to create C++ NuGet packages: http://coapp.org/releases• Some C++ NuGet packages to try out: http://nuget.org/profiles/coapp/
Start downloading, then head on back here to learn more about NuGet and how to create and use packages for C++ libraries.
What is NuGet?From the NuGet website:
NuGet is a Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects... If you develop a library or tool that you want to share with other developers, you create a NuGet package and store the package in a NuGet repository. If you want to use a library or tool that someone else has developed, you retrieve the package from the repository and install it in your Visual Studio project or solution.
With the NuGet 2.5 release, you can download and add libraries to your C++ projects without having to configure properties for include or library directories, and making sure those properties are set correctly in all of your project configurations. For C++, the way we implement this is by generating files with MSBuild properties and targets, and including those files in the NuGet package. When the package is installed and referenced by your project, the MSBuild files are imported into your project file, so your projects will know how to find and use the contents of the NuGet packages. Packages are cached on a per-solution basis – if you’re using the same library in multiple projects in your solution, they’ll point to a common copy of the package.
Check out this post on the NuGet team blog for a more in-depth look at how NuGet for C++ was designed.
Getting StartedNuGet is included in both Visual Studio 2010 and Visual Studio 2012. You’ll need to update the NuGet extension to version 2.5 in order to use the C++ project integration. The NuGet website (nuget.org) has extensive documentation on how to install and use NuGet. You can use NuGet in any C++ project type – this works for desktop, Windows Store, and Windows Phone 8 applications equally.
The NuGet Gallery on nuget.org is the central package repository used by all package authors and consumers. Since C++ support in NuGet is brand new, there aren’t a lot of packages available in the NuGet Gallery yet. However, the CoApp project has created a few packages from open source libraries which you can use right now to get started. You can find their packages on the NuGet gallery here. To find other packages, try using a search on “tag:native” on the NuGet Gallery (this also works when searching for packages using the VS IDE integration), though be aware that not all packages tagged with “native” are actually C++ projects.
Creating packagesIf you’re interested in publishing your libraries via NuGet, you can choose to create the NuGet packages manually. However, there’s an easier way. The CoApp project volunteered to write C++ oriented tools to create NuGet packages, and have released a beta version of their tools on their website. These tools simplify the process of generating the MSBuild files and NuGet packages from existing header and library files – you just need to create a configuration script to describe the contents of the package, and then run the tools to generate the NuGet package.
There are tutorials, reference documentation, and a video on how to use the tools to create NuGet packages. The CoApp project organizers also plan to create and publish packages for several open source libraries into the NuGet Gallery over the next several weeks.
At this time, we’re encouraging people to publish packages with the “native” tag to make it easier to find packages you can use in C++ projects.
The CoApp and Openness@Microsoft blogs have additional information about this project.
FeedbackPlease leave us feedback here on the blog – we’d love to hear your experiences trying out NuGet in your C++ projects, and whether there are additional features we could add to make this work even better for you. This is just the start of C++ integration in NuGet – we need your input on where we should take this in the future to make working with C++ libraries in Visual Studio easier.
If you have specific feedback or issues with these tools here are direct links to the project sites:- NuGet project on CodePlex- CoApp website
Why all this? Why not grab the lib, add a #pragma...lib, include, and be done! Is it to be more like the Unix boys, who have to deal with incompatibility like having only one sock of any pair? I say, nonsense. But don't let that stop you from being like the herd.
who cares about nuget?? we need more cpp14 features!!!!!
@Alex how about we start with c++11 features?
Searching Nuget for "C++" yields results for C# libraries. Making this search work would be a great step towards usefulness.
Please write a generic library for NDIS 6.3 interface driver! So the already orphaned Windows RT OS get 3g and 4g dongles drivers a "bit" sooner than the OS is declared a total flop!!!
How hard was it for you geniuses at Microsoft responsible for HAL to include that driver in the OS in first place!
I wonder why do you guys make us BEG for these minor things which are must have and available in every modern OSes?
This is awesome! It is great that Microsoft still invest in the C++ language environment. Up till now everything is just about C#. A package management system for C++ increase productivity because it simplifies discovering and using 3rd party libraries. Developers don't need to spend time downloading and building the binaries themselves. Or packages can be added from an internal corporation feed. All this without fighting with #pragma lib and missing header files. Or bloating up the version control system with 3rd party libraries. Perhaps we will see better support for native references in future versions of VS!
@Matt - Thanks for reporting the NuGet search issue when searching for "C++" on NuGet. NuGet's search doesn't presently recognize any special characters, so "C++" and "C#" actually end up yielding the same search for just "C".
The team behind the NuGet Gallery (nuget.org) will investigate this though, so that we can improve search results.
Thanks for the feedback,
Would be cool if Visual Studio 2012 use C++ debugger visualizers (*.natvis, *.natstepfilter) form NuGet packages. Like described in that article for VS extensions blogs.msdn.com/.../10329460.aspx
When will you release Visual Studio 2012 compiler update with more c++11 features, previewed in November 2012 CTP (more than half a year ago)?
I second Alex's request for more information on the next VC++ compiler update. It's very frustrating to see clang announce full C++11 compliance and initial work on C++14 features while Microsoft has thus far only released a 6+ month old CTP of their compiler without a go-live license. So far you don't seem to have lived to your promise of frequent compiler updates (VS updates are coming it at a nice pace though, and I think the community appreciates that).
Both GCC and CLang already support all of C++11 features and some C++14 features.
Visual C++ 2008 used to be a front-runner.
Visual C++ 2012, even with the crippled CTP, is a laggard.
This is great news. I waited for this for a long time. This should make it much easier to publish and consume native libraries. I already created a package for a library that I worked on and I hope many will do the same.
On the other hand, most of the comments here are totally off-topic. We all want more C++ standard features and more libraries, but let's not pollute the discussion here with that. As for more libraries, well, NuGet support for native libraries should allow people to use... more libraries in an easier way.