Upload
andrei-marukovich
View
147
Download
0
Embed Size (px)
Citation preview
.NET ecosystem
.NET Framework .NET Core Xamarin
WPF
ASP.NET
WinForms UWP
ASP.NET Core
iOS
macOS
Android
Code sharing and library types
• Source file links
• Shared projects
• Portable class libraries (PCLs)
• .NET Standard
Shared projects
• Better version of the source file links
UWP project Xamarin project
File1.csFile2.cs
SharedLib
File1.csFile2.cs
SharedLib
File1.csFile2.cs
SharedLibUI
App layer
UI
App layer
Portable class libraries
• Sharing code in binary form, without recompiling
UWP project Xamarin project
File1.csFile2.cs
PortableLib
UI
App layer
UI
App layer
How it works?
• PCLs are based on profiles
• Profile defines an API surface supported by the library
• Profile is identified by combination of supported platforms• http://embed.plnkr.co/03ck2dCtnJogBKHJ9EjY
• C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\
.NET Standard
• An evolution of PCLs, recommended approach for new libraries*
• Defines a set of APIs to be implemented by .NET platforms (specification)
• Is versioned (API level)
• Version defines API surface, not supported frameworks• The higher the version, the more APIs you have
• The lower the version, the more .NET platforms implement it
• Library developers may choose target .NET Standard version
.NET Standard
• Current state• Tooling is in preview
• Currently PCLs support a wider range of platforms
• At the moment, PCL adoption (# of libraries) is higher than .NET Standard
• Future• PCL replacement
• Standard 2.0 will have significantly larger API surface
• Standard 2.0 will be interoperable with .NET Framework
Recap
• .NET Standard is the future
• project.json is obsolete
• .csproj, msbuild and NuGet play nicely together
Additional information
• Additions to the csproj format for .NET Core• https://docs.microsoft.com/en-us/dotnet/articles/core/tools/csproj
• NuGet pack and restore as MSBuild targets• https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets
• How to use new features of MSBuild 15 with .NET Framework projects• http://lunarfrog.com/blog/how-to-use-msbuild15-net-framework