Examine .NET Core As a Development Platform for Monitor ERP System AB
Total Page:16
File Type:pdf, Size:1020Kb
Examine .NET Core as a development platform for Monitor ERP System AB Viktor Rosvall Computer Engineering BA (C), Final Project Main field of study: Computer Engineering Credits: 15 hp Semester, year: Spring, 2020 Supervisor: Martin Kjellqvist, [email protected] Examiner: Dr. Ulf Jennehag, [email protected] Degree programme: Datateknik, 180 credits Examine .NET Core as a development platform for Monitor ERP System Viktor Rosvall 2020–06–12 Abstract The objective of this study has been to examine the portability of Moni- tor ERP System AB’s existing .NET Framework codebase to .NET Core. The study has been conducted by examining the portability of Monitor’s projects by using Microsoft’s .NET Portability Analyzer and visualizing the dependencies of projects by using AsmSpy to gain an understanding of what order projects need to be ported. An examination of used third-party libraries has also been conducted to see which libraries are not compatible with .NET Core. And an attempt to port Monitor’s root solution has been made as a proof-of-concept and to make test and build duration compar- isons between the ported solution and the old solution. The .NET Porta- bility Analyzer reported that 19 projects aren’t 100% compatible with .NET Core (+ Windows Compatibility Pack) where some projects have one miss- ing API call while others have many more. The third-party library examina- tion showed that two libraries are not compatible with .NET Core, the first is Dynamsoft Dynamic .NET TWAIN SDK which can probably be replaced with VintaSoft Twain .NET SDK, and SAP SQL Anywhere which doesn’t have a direct replacement. The results of the comparison show that test duration speeds improved on average by 22.5% with a peak of 67.6%, and build duration differences were negligible. Porting to .NET Core will not be easy, but if fixes for the 19 incompatible Monitor projects are completed and a replacement for SQL Anywhere can be found, then Monitor ERP System AB can make a successful port to .NET Core. Keywords: .NET Core, .NET Framework, Large codebase, Migration, Mon- itor ERP System AB, Port i Examine .NET Core as a development platform for Monitor ERP System Viktor Rosvall 2020–06–12 Acknowledgements I would like to thank Monitor ERP System AB for providing me with a workplace at their office and also a place to stay while working in Hudiksvall. I’m very grateful for the support of Peter Svensson and his team at Monitor has given me during my thesis project at their office. I would also like to thank my supervisor Martin Kjellqvist from the univer- sity who gave me great guidance and was always available when I needed his help. ii Table of Contents Abstract i Acknowledgements ii Terminology v 1 Introduction 1 1.1 Background and problem motivation ............... 1 1.2 Overall aim .............................. 1 1.3 Scope ................................. 1 1.4 Concrete and verifiable goals ................... 2 1.5 Outline ................................ 2 2 Theory 3 2.1 Microsoft .NET Framework ..................... 3 2.2 Microsoft .NET Core ........................ 3 2.2.1 .NET implementation support ............... 3 2.3 NuGet ................................. 4 2.4 Windows Compatibility Pack .................... 4 2.5 SAP SQL Anywhere ......................... 4 2.6 MSTest ................................ 5 2.7 Monitor ERP System AB’s Domain-Specific Language ..... 5 2.8 .NET Portability Analyzer ...................... 5 2.9 AsmSpy ................................ 5 3 Methodology 6 3.1 Workflow ............................... 6 3.1.1 Pilot study .......................... 6 3.1.2 Planning ........................... 6 3.1.3 Construction ......................... 6 3.2 Hardware and software ....................... 6 4 Process 8 4.1 Portability analysis .......................... 8 4.2 Project dependency analysis .................... 8 4.3 Porting ................................ 9 4.4 Testing ................................ 10 4.5 Building ................................ 10 5 Results 11 5.1 Portability analysis .......................... 11 5.1.1 First-party source code portability ............. 11 5.1.2 Third-party library compatibility .............. 12 5.2 Project dependency analysis .................... 13 iii Examine .NET Core as a development platform for Monitor ERP System Viktor Rosvall 2020–06–12 5.3 Porting ................................ 13 5.4 Testing ................................ 14 5.5 Building ................................ 16 6 Conclusion 18 6.1 Goals ................................. 18 6.2 Porting ................................ 18 6.3 Testing ................................ 19 6.4 Building ................................ 19 6.5 Recommendations ......................... 19 6.6 Ethical aspects ............................ 20 6.7 Method discussion ......................... 20 6.8 Further studies ............................ 20 References 22 A Monitor.Service.Contracts class diagram dependency graph 1 iv Examine .NET Core as a development platform for Monitor ERP System Viktor Rosvall 2020–06–12 Terminology AOT Ahead-of-time API Application Programming Interface CAS Code Access Security CLR Common Language Runtime DBMS Database Management System DGML Directed Graph Markup Language DSL Domain Specific Language EIM Electronic Invoice Management GUI Graphical User Interface JIT Just-in-time LTS Long-term Support Monitor Monitor ERP System AB SDK Software Development Kit SSVM Server-Side View Models Std Standard Deviation WPF Windows Presentation Foundation v Examine .NET Core as a development platform for Monitor ERP System Viktor Rosvall 2020–06–12 1 Introduction Porting a large codebase from one development platform to another can be a big undertaking. This report will try to provide guidance when port- ing from the Microsoft .NET Framework to the Microsoft .NET Core devel- opment platform, and it will mention solutions to problems when porting large projects to .NET Core. This report will also present the benefits of porting to .NET Core, such as improvements in test duration speeds when running automated unit-tests, and language features only available in the newer .NET Core 3 platform. 1.1 Background and problem motivation Monitor ERP System AB (Monitor) is currently developing an Enterprise Resource Planning (ERP) system called MONITOR G5 for small- to medium- sized manufacturing companies. MONITOR G5 features six modules that cover all activities of manufacturing companies [1]. Monitor is currently using the classic .NET Framework that is tightly cou- pled to Windows for development of MONITOR G5. The new .NET Core platform offers cross-platform development which would allow Monitor application servers and other Monitor products to run on Mac OS and Linux. Monitor wants to future-proof their codebase by upgrading to .NET Core as newer versions of the C# language won’t be supported on .NET Framework. Monitor would also like to support cross-platform development to reduce the cost of running Windows virtual machines in the cloud. 1.2 Overall aim The projects aim is to provide Monitor with a report on how to migrate their codebase to the new .NET Core Platform. This report will include the chal- lenges of such a migration and possible solutions. It will also include mea- surements comparing build times and automated unit-test duration after a migration, to see if automated tests and the building process can increase in speed after a migration to .NET Core is completed. 1.3 Scope This study will mostly focus on the theoretical aspects of porting Monitor’s current .NET Framework Application Server to the new .NET Core plat- form. This work doesn’t include the porting of database systems needed to be compatible with .NET Core. 1 Examine .NET Core as a development platform for Monitor ERP System Viktor Rosvall 2020–06–12 Because of the sheer size of Monitor’s codebase, this work will only cover the process of porting the Monitor.Service.Contracts solution and its projects which has no or few dependencies on other Monitor solutions and projects as a proof-of-concept while documenting the process. 1.4 Concrete and verifiable goals The goals of this report are to answer the following questions: 1. Examine the codebase for portability issues 2. Locate incompatible third-party libraries 3. Examine tools used to aid in porting 4. Successfully port the root solution of projects 5. Document the porting process 6. Measure the change in test time duration 7. Measure the change in build time duration 1.5 Outline Chapter 2 describes some of the technologies used to help the reader un- derstand the result better. Chapter 4 describes the work process of porting and usage of tools to gather data. Chapter 5 contains the results of the work process. Chapter 6 describes the conclusions derived from the results and recommendations to Monitor ERP System AB for how to proceed. 2 Examine .NET Core as a development platform for Monitor ERP System Viktor Rosvall 2020–06–12 2 Theory This chapter shortly describes the products and technologies used by Mon- itor ERP System AB for their MONITOR Server application. 2.1 Microsoft .NET Framework Microsoft’s .NET Framework is a proprietary platform that supports build- ing and running Windows applications and websites [2]. A large com- ponent of the .NET Framework is called the Common Language Runtime (CLR), and similarly to the Java Virtual Machine, handles memory man- agement, thread execution, garbage collection and code execution [2], [3]. Another large component of the .NET Framework is