Skip to content
Richard Schneider edited this page Oct 15, 2017 · 9 revisions

Porting to .net standard 2

This is blog on what I'm doing to port the library to .net standard 2. All changes are in the netstandard branch.

Prerequisites

The dev platform needs VS2017 and .NET Core 2.0 SDK. Use dotnet --info to verify.

>dotnet --info
.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Dependencies

Need .net standard version of the following dependent packages

<packages>
  <package id="Albireo.Base32" version="1.0.1.0" targetFramework="net45" />
  <package id="Base58Check" version="0.2.0" targetFramework="net45" />
  <package id="Common.Logging" version="3.3.1" targetFramework="net45" />
  <package id="Common.Logging.Core" version="3.3.1" targetFramework="net45" />
  <package id="Google.Protobuf" version="3.1.0" targetFramework="net45" />
  <package id="SHA3" version="0.9.2" targetFramework="net45" />
</packages>

Base32, Base58Check and SHA3 do not target .net standard. However, then should run okay. So disable the warning, see scenario 3.

Assembly info

New style is to place and build assembly info in .csproj, but we can disable this behaviour with

    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>

Nuget

It is better to move all assembly info into .csproj and remove AssemblyInfo.cs. Package info is also moved in .csproj and delete .nuspec.

See also