NuGet Packages and Library Files
-
I'd like to put all of my custom classes into a .NET Framework DLL so that I can share them among many different executables. If I install a NuGet package to the DLL, are the classes in that package supposed to be available to any EXE that holds a reference to the DLL? Or NuGet packages can't be shared that way, meaning the package must be installed to the EXE, not the shared library?
The difficult we do right away... ...the impossible takes slightly longer.
-
I'd like to put all of my custom classes into a .NET Framework DLL so that I can share them among many different executables. If I install a NuGet package to the DLL, are the classes in that package supposed to be available to any EXE that holds a reference to the DLL? Or NuGet packages can't be shared that way, meaning the package must be installed to the EXE, not the shared library?
The difficult we do right away... ...the impossible takes slightly longer.
In my experience, NuGet packages are on a project basis (dll; exe), though you can manage them at the solution and project level. You can "share" a dll's Nuget package via the dll as an "interface"; otherwise, I know of no way to surface "name spaces" from a dll other than the one it "owns".
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
In my experience, NuGet packages are on a project basis (dll; exe), though you can manage them at the solution and project level. You can "share" a dll's Nuget package via the dll as an "interface"; otherwise, I know of no way to surface "name spaces" from a dll other than the one it "owns".
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
Thanks for the response, Gerry. Can you elaborate on what you mean by sharing the package as an interface? Do you mean I'd have to write code (interfaces) that specifically expose the types in the NuGet package?
The difficult we do right away... ...the impossible takes slightly longer.
-
I'd like to put all of my custom classes into a .NET Framework DLL so that I can share them among many different executables. If I install a NuGet package to the DLL, are the classes in that package supposed to be available to any EXE that holds a reference to the DLL? Or NuGet packages can't be shared that way, meaning the package must be installed to the EXE, not the shared library?
The difficult we do right away... ...the impossible takes slightly longer.
When you use or deploy the .DLL to another .EXE project, you have to ship the .DLL's in the NuGet package with your .DLL. Your .DLL won't work without them. As for being available to the .EXE, yes, the NuGet .DLL's will also be available to the executable project, just like they were for your .DLL project.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
When you use or deploy the .DLL to another .EXE project, you have to ship the .DLL's in the NuGet package with your .DLL. Your .DLL won't work without them. As for being available to the .EXE, yes, the NuGet .DLL's will also be available to the executable project, just like they were for your .DLL project.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakOK, thanks Dave.
The difficult we do right away... ...the impossible takes slightly longer.
-
Thanks for the response, Gerry. Can you elaborate on what you mean by sharing the package as an interface? Do you mean I'd have to write code (interfaces) that specifically expose the types in the NuGet package?
The difficult we do right away... ...the impossible takes slightly longer.
Yes. A proxy.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
I'd like to put all of my custom classes into a .NET Framework DLL so that I can share them among many different executables. If I install a NuGet package to the DLL, are the classes in that package supposed to be available to any EXE that holds a reference to the DLL? Or NuGet packages can't be shared that way, meaning the package must be installed to the EXE, not the shared library?
The difficult we do right away... ...the impossible takes slightly longer.
The classes and functionality from the NuGet package won't be automatically available to the executables (EXE files) that reference this DLL. Each executable project that uses the DLL must also have its own references to the required NuGet packages.