Getting Started with .NET Core and .NET Standard

Introduction

All .NET Edition toolkits include libraries compiled for .NET Standard. These libraries may be used in any platform which supports .NET Standard 1.4 or higher.

Contents

Installation

NuGet
The easiest way to install the library is through NuGet. You can find all .NET Edition packages in the NuGet gallery. For instance you can search for IPWorks.

VS 2017 NuGet results

.NET Edition Setup
In addition to NuGet the libraries are included when running the Windows setup for the .NET Edition and are placed in the lib\netstandard2.0, lib\netstandard1.6 and lib\netstandard1.4 folders of the install directory.

Supported Platforms and Versions

The toolkit is compiled for .NET Standard 2.0, 1.6, and 1.4. When adding the package via NuGet the correct version is automatically selected depending on your project settings. By supporting .NET Standard 2.0, 1.6, and 1.4 a wide range of platforms are supported. This includes:

  • .NET Core (1.0+)
  • ASP.NET Core (1.0+)
  • Universal Windows Platform (UWP 10.0+)
  • Xamarin.iOS (10.0+)
  • Xamarin.Android (7.0+)
  • Mono (4.6+)

No special steps are required to target a supported version. After creating your project simply add the NuGet package and start using the components.

.NET Core App on Linux

While the use of the components is the same in all platforms that support .NET Standard, to better illustrate how the components may be used the below example uses the components in a .NET Core Console Application running on Linux.

To begin add the nsoftware.IPWorks NuGet package as described above. Once added add some simple code in the main method. For instance:

using System;
using nsoftware.IPWorks;

namespace MyNetCoreApp
{
  class Program
  {
    static void Main(string[] args)
    {
      Http http = new Http();
      http.Get("https://www.nsoftware.com");
      string myData = http.TransferredData;
      Console.WriteLine("Transfer OK!");
    }
  }
}

To deploy right click the project in the Visual Studio solution explorer and select Publish.... Follow the prompts to create the files necessary for deployment. Copy the files from the bin\Release\PublishOutput folder to the Linux machine.

To install a trial license for the components on the Linux system copy the files from C:\Program Files\nsoftware\IPWorks 2016 .NET Edition\lib\netstandard2.0 to the deployment machine and run:

dotnet ./install-license.dll

After installing the trial license run the compiled .NET Core application:

dotnet ./MyNetCoreApp.dll

The output should look like:

Linux test app results

Licensing Notes

Whether installing from NuGet or running the Windows .NET Edition setup licensing is handled in the same manner.

Trial Licensing

To activate a trial license use the install-license application. The install-license application is a .NET Core console application included in the toolkit.

If the library was installed from a NuGet package this is present in the tools folder in the package installation directory.

If the library was installed as part of the .NET Edition installer this is present in the lib/netstandard1.X folders in the installation.

To use the install-license application run the command:

dotnet ./install-license.dll

When using a trial license in non-desktop environments such as Universal Windows Platform (UWP), Xamarin.iOS, and Xamarin.Android no special steps are required; simply create and use the component.

UWP Fall Creator's Update and Later requires the trial license to be included as an embedded resource. From the solution explorer in Visual Studio add an existing item to the project and add %USERPROFILE%\.nsoftware\XXNXA.lic. Set the Build Action property for the file to Embedded Resource.

License Activation

In NuGet you should be prompted to install a license during the install process. In the Windows .NET Edition setup a license is automatically installed. Alternatively the install-license application is a .NET Core console application included in the toolkit.

If the library was installed from a NuGet package this is present in the tools folder in the package installation directory.

If the library was installed as part of the .NET Edition this is present in the lib/netstandard1.X folders in the installation.

To use the install-license application run the command:

dotnet ./install-license.dll <key>

Where key is your product key. This will install a license to this particular system. Read on for deployment instructions.

Deployment

The RuntimeLicense property must be set before deploying your application. To obtain this value on a properly licensed development machine output the current value of the property. For instance:

Console.WriteLine(component.RuntimeLicense);

This will output a long string. Save this value and use it in your real application like so:

component.RuntimeLicense = "value_from_above";

Note: The same RuntimeLicense property value works for all components included in the toolkit.


We appreciate your feedback.  If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.