Porting to .Net Standard 2.0 Introduction

The Software Potential development team at InishTech has decided to undertake the somewhat daunting task of adding support for .Net Standard to

  1. Our code protection system
  2. Our secure code execution engine
  3. Our licensing libraries

With .NET Standard support we will be able to protect and license .Net code on all supported platforms, not only Windows IoT and HoloLens, but also iOS and Linux.

We have been eager to start this work since the first announcement of .Net Core in 2014, but until the announcement of NetStandard 2.0 there were some insurmountable blockers.

We did an earlier spike on NetStandard 1.6 to get a rough idea of the scope of work involved. Significant code changes were needed, especially around reflection, but all seemed well until we hit the mother of all road blocks. There was no support for FieldInfo.FieldHandle or MethodInfo.MethodHandle, both critical constructs when building your own execution engine. Happily they had already both been slated for support in NetStandard 2.0

Work began in the office two weeks ago on NetStandard 2.0 preview 2 support. So far barring some expected issues with Windows specific or legacy constructs it has been a pleasant surprise. Even having heard all the talk of a very large api surface I never expected it to be so frictionless. I had every expectation that I would get it to compile with minimal effort and then run into an infuriating amount of NotSupportedExceptions at runtime. Instead, within 2 weeks, I have managed to compile, protect and run protected and licensed code. Now don't get me wrong, we still have a very significant body of work ahead of us. However, to have a working POC in only 2 weeks in such a large and complex system speaks volumes about the vast improvements that have gone into NetStandard 2.0 compared to the early versions of both .Net Core and .Net Standard.

In this series I hope to cover the process of porting our system. So far the main batches of work known to us are:

  1. Creating new netstandard 2.0 projects and inlining existing projects
  2. Porting MEF 1.0 to MEF 2.0 in .Net Core
  3. Dependency Resolution using Microsoft.Extensions.DependencyModel
  4. Porting System.Web.Services WCF to System.ServiceModel in .Net Core
  5. Virtual Machine Detection

In the first post in this series I will cover the work done to date, from VS 15.3 preview installation to the occasional #ifdef to get over the initial compilation hump.

Part 1: Creating a .Net Standard Project from existing .Net 4.0 code