Can Nuget be used with C++ projects?

May 24, 2011 at 3:34 AM

Hi All

At our company we're looking at improving the management of the 3rd party libraries that we use. I was wondering if it is possible / useful to use NuGet to handle this for us? I can understand that we won't be able to add references etc. but could we still use the other capabilities of NuGet to add the 3rd party libraries (all statically linked libraries) to our workspace directories?



May 24, 2011 at 3:43 AM

NuGet doesn't work with C++ projects currently. However, we do accept external contribution if one wants to add support for C++.

May 24, 2011 at 3:55 AM

I don't think the company is willing to spend time on adding support :( But in any case thanks for the amazingly fast reply!


May 24, 2011 at 5:18 AM
At minimum, you can use Nuget.exe outside of VS to download and unpack packages and their dependencies. You'd have to add files to VS manually, but. It handles everything up to that.
May 24, 2011 at 5:44 AM

I'm curious, what kinda support are you looking for with c++? What kind of libraries are you using?

May 24, 2011 at 6:00 AM

At the moment we are only using some statically linked ones so we won't need an 'Add references' ability or anything like that.

The libraries are stored in our SVN repository and they are linked to the projects via an SVN externals directive. Unfortunately it is a big hassle to update the externals directives if the library versions change (some of them are our own and change quite often). So we're wondering if we could make our own local NuGet repository / storage and put all the libraries in there. Then we can just pull the correct versions of the libraries into the workspace and use them. Obviously we haven't tried any of this but I figured it might be worth while asking if C++ was supported at all first.

I think we should be able to just use NuGet outside of VS to get the desired packages. Combined with some MsBuild and Powershell magic we should be able to get it to work I hope.

May 24, 2011 at 6:16 AM

Let us know what you come up with :)

May 24, 2011 at 6:25 AM

I will do. It might take a while though. The wheels aren't moving very fast here ... :(

Jun 1, 2011 at 11:38 AM

What would it actually take to add 1st class C++ support?

I'm working with a team who are downstream of several other "framework" teams within a large enterprise - they have to consume many libraries - some managed, some native. I've already set up an internal NuGet Gallery and they are keen to use it - but would like a similar workflow for their native DLLs and Libs.

I have some capacity to contribute to this feature - but I'd need a bit of help / guidance from the core team


Jun 1, 2011 at 3:22 PM
Edited Jun 1, 2011 at 3:22 PM

Take a look at the VsProjectSystem class. Basically, you need to write a CPlusPlusProjectSystem, derived from VsProjectSystem. Then implement/override as many methods as appropriate for a C++ project. You can take a look at other derived classes for reference.

It's likely that the current API of IVsProjectSystem doesn't cover all the needs of unmanaged projects (e.g. reference unmanged assemblies, etc.). In which case, post your question here so we can come up with a solution to support them. 

Oct 21, 2011 at 2:24 PM
Edited Oct 21, 2011 at 2:25 PM

There is a work item associated with this ([workitem:868]) and hopefully some work is in progress, starting today.

The fork is SupportCppProjects.