简体   繁体   中英

Using libgit2 C API within Visual Studio 2013

From native C++, I want to use the libgit2 C-API, and I happen to be using Visual Studio 2013 .

Recall that Microsoft is using libgit2 for internal git support in Visual studio starting in 2010/2012, as discussed here:

I see two options:

(1) Download, build & use libgit2 for Visual Studio 2013 as described here: http://libgit2.github.com/docs/guides/build-and-link/

(2) Code against the libgit2 C-API library as-bundled/installed within Visual Studio (IS THIS POSSIBLE?)

Note that I want the libgit2 C-API, and it is acceptable to use whatever version happens to have been installed with Visual Studio .

Rationale: I'm lazy and don't want to build/install it separately; and, it seems weird (and perhaps might introduce issues) if I have multiple libgit2 versions installed-and-running at the same time (probably shouldn't be an issue, but it still seems weird). A pre-built binary I could directly install from another site would be another option.

QUESTION: Can I do (2)? Where are the headers (how do I configure a project for them)?

We would strongly discourage you from using the version of libgit2 that is included with Visual Studio. This is an older version of libgit2 than what you see at libgit2.github.com which does not even match up to a released version of the library. It includes custom patches that have only been tested inside Visual Studio itself and may destabilize using libgit2 in your own application. While we turn these patches into pull requests that are eventually included in libgit2, there have been occasions when we have had to made quick bugfixes that would not have been appropriate for any other users of the library.

Further, neither the libgit2 project nor Microsoft will support you if you try to go down this route.

I am very interested in providing a native nuget package for libgit2 so that this is easier. Unfortunately, there are some difficulties in providing this at the moment.

Until this is available, I would strongly suggest you follow the instructions provided to build and link libgit2 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM