How to Use MyGet to Manage and Distribute Packages

Xiao Ling
3 min readJan 2, 2020

--

MyGet is a universal package manager that allows you to create custom package feeds for Python, Maven, NuGet, npm, Bower, PHP, Vsix, and Ruby Gems. For me, the most significant advantage of using MyGet is I can overwrite the package with the same version number comparing to other package repositories like PyPi and npmjs. This article shares how to upload Dynamsoft Barcode Reader packages to MyGet and how to install the packages for relevant projects.

Uploading Packages to MyGet

Create a MyGet account. Sign in to MyGet and create a feed.

I created a feed for Dynamsoft packages.

The next step is to click ADD PACKAGE to upload relevant packages. I will upload packages for Maven, Python, NuGet, and NPM.

Maven

Upload the pom.xml and .jar files.

Python

Upload the .whl file.

NuGet

Upload the *.nupkg file.

NPM

I failed to upload a zip package when using NPM. Using command-line tool seems more convenient.

Click FEED DETAILS to get your npm feed URL.

Run the adduser command via command-line tool:

npm adduser --registry=https://www.myget.org/F/dynamsoft/npm/

Publish the package with the new registry:

npm publish --registry=https://www.myget.org/F/dynamsoft/npm/

Installing Dynamsoft Barcode Reader Packages from MyGet

Get the free trial license.

Maven

Create a Maven project and add the configuration to pom.xml:

<repositories><repository><id>dbr</id><url>https://www.myget.org/F/dynamsoft/maven/</url></repository></repositories><dependencies><dependency><groupId>com.dynamsoft</groupId><artifactId>dbr</artifactId><version>7.2.2</version></dependency></dependencies>

Set the license:

BarcodeReader br = new BarcodeReader("LICENSE-KEY");

Sample code:

Python

Install dbr:

pip install -index-url https://www.myget.org/F/dynamsoft/python/ dbr

Set the license:

dbr.InitLicense(license)

Sample code:

NuGet

In Visual Studio 2017, add the package source https://www.myget.org/F/dynamsoft/api/v3/index.json.

Install the package to your .NET project.

Set the license:

mBarcodeReader = new BarcodeReader("LICENSE-KEY");

Sample code:

NPM

Install dynamsoft-javascript-barcode via the custom registry:

npm set registry https://www.myget.org/F/dynamsoft/npm/ 
npm install dynamsoft-javascript-barcode

Set the license by replacing the data-productKeys:

<script src="node_modules/dynamsoft-javascript-barcode/dist/dbr.js" data-productKeys="LICENSE-KEY"></script>

Sample code:

Source Code

https://github.com/yushulx/myget-barcode-sample

Originally published at https://www.codepool.biz on January 2, 2020.

--

--

Xiao Ling
Xiao Ling

Written by Xiao Ling

Manager of Dynamsoft Open Source Projects | Tech Lover

No responses yet