Private Library: Is there a way to flag required packages and their versions (or...?)
I've built an unpublished helper library to handle routines shared by many programs - for example, handling OAUTH2.0 for SMTP, since everyone loves their automated email reports.
The library references the package Microsoft.Identity.Client and therefore the program which references the library must also reference that specific version of Microsoft.Identity.Client. However, sometimes I forget and I'm only reminded when I hit a runtime error.
Is there a way to flag these requirements in Visual Studio and to get the compiler to warn of missing packages or version mismatches?
Alternatively, is there a legal way to bundle Microsoft.Identity.Client.dll into my JustinsLibrary.dll?
If not, I'll manage, but it sure would be convenient. Thanks
If not, I'll manage, but it sure would be convenient. Thanks
6 Replies
You should distribute your library as a NuGet package. Then your package manifest specifies what your dependencies are, and the dotnet tooling automatically resolves everything for you
(You don't need to push NuGet packages to nuget.org. You can have a private package feed, or just drop them in a local folder and point VS at that)
Ah! That I did not know. That solves quite a bit.
I didn't want to make the library public (mostly because I'm shy and this is all very custom noodling work that I do).
If you use e.g. GitHub to manage your library, you can set up a private package feed there IIRC. Then you point VS at that, and all projects which use that package can pull updates etc
Or yeah, just a folder on a drive
(This is a really common use-case for companies which write and consume code internally, fwiw)
Thank you so much. I'm going to close this post as solved.
$close
If you have no further questions, please use /close to mark the forum thread as answered