Lib dependencies in C #?

1

I'm doing some lib in C # to use in my projects and not always have to rewrite. but how do I do with Lib's dependencies?

Example:

I made a lib to use Google Drive and it has the name lib.GoogleDrive but needs to go together:

Google.Apis.Auth.dll
Google.Apis.Auth.Mvc4.dll

What would be the smartest way to use lib?

Add the lib project in the project that will use it or do routine to publish my DLL with the% dependency%?

or

Using Nugget and making a package with dependencies ?

    
asked by anonymous 01.02.2018 / 12:04

1 answer

0

The correct one is as follows:

Make your% c and private% add the dependencies in your project, after that, your project to work needs that the dependencies are present, but each library maintainer is responsible for its update, that is, if it was added a dependency and it is updated its Lib also needs to happen this update ( not mandatory, but, for reasons of lib and corrections it is good to keep projects updated ) and a new publication with these changes must occur.

Summarizing each project and its updates is the responsibility of the maintainer of the library and are independent.

In Visual Studio 2017 , for example it is easy to make libraries and add dependency packages, eg:

  

Inthissamplelibraryyouhaveadependencyonthepackage Newtonsoft.Json , and your project depends on it to work, but are projects maintained by different users and each receives updates according to their needs.

To configure the generation of this package click on the project with the right button and in the menu the properties opens the following screen:

GenerateNugetpackageonbuildtogeneratethepackageanditsdependencieswhentheprojectisgenerated.

  

Openingthispackageinthe Nuget Package Explorer verifies that you added the dependency as expected.

  

    
02.02.2018 / 19:55