How To Publish and Install DotNet SDK With NuGet
NuGet is the package manager for the Microsoft development platform. The post shares how to publish and install packages with NuGet via the GUI tool.
Join the DZone community and get the full member experience.
Join For FreeA package manager is a tool that automatically installs, updates, and uninstalls distributions of software based on a central installation large database. With a package manager, users do not have to download an application installer manually. There are numerous package managers for various programming languages and platforms like Maven, npm, pip, apt-get Yum, and many more. In this post, we shall look at how to publish and install packages with NuGet.
What Is NuGet?
NuGet is a package manager for the Microsoft development platform. Users can access NuGet through the command line tool, Visual Studio, or Package Explorer.
- Download
- Windows x86 Commandline
- Visual Studio 2012
- NuGet Package Explorer
It is also possible to install NuGet Package Manager in Visual Studio. Select the Tools > Extensions
and Updates menu option, and then search for NuGet:
Once the extension is installed, you can find it from the Tools > NuGet
Package Manager menu option:
Publishing a Package
We must first understand how to set up the directory structure before generating a package:
- Tools: It is a folder containing PowerShell apps and scripts that may be accessed through the Package Manager Console.
- Lib: lib is the folder
containing.dll
files, which are inserted after package installation as assembly references. - Content: When the package is installed, the files within the folder are copied to the application's root.
- Build: build is the folder containing MSBuild targets files that are automatically added to the application's
.csproj
file.
Let's use NuGet Package Explorer to develop a package for Dynamic.NET TWAIN. Depending on your desire, you can use a GUI tool or a command line tool.
To create a new package, choose File > New
from the menu. To edit the package data, follow:
To create the lib folder, choose Content > Add > Lib
Folder from the menu. To add a .NET folder, right-click on the lib folder and choose Add.
Place already-existing.dll
files in the appropriate folders:
Choose File > Save As
to create Dynamsoft.DotNet.TWAIN.6.1.1.nupkg
package. Use a file archiver to view the structure of the.nupkg file:
You must create an account to publish the package.
Locate Your API Key
Now, you may submit your package online and publish it:
Or with the NuGet Package Explorer:
Please read the article Managing Packages Using the Package Manager Console if you would rather update and delete packages using the command line.
Steps To Install a Package
Make a fresh WinForm or WPF project. To access the Package Manager Console or Manage NuGet Packages for Solution, select Tools > NuGet Package Manager
.
Using a GUI, install a package:
Apply a package using the command line:
Upon installation of the package, Dynamic.NET TWAIN references were automatically added:
The Testing Code Snippet
using Dynamsoft.DotNet.TWAIN;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DynamicDotNetTwain t = new DynamicDotNetTwain();
}
}
}
Opinions expressed by DZone contributors are their own.
Comments