Blog: PCL

Use T4 TextTemplatingFilePreprocessor in .NET Standard or PCL libraries

April 25, 2017, Software Development

For my projects NJsonSchema and NSwag I wanted to use T4 templates to programmatically generate code generating code (TextTemplatingFilePreprocessor). Adding the .tt file with its generated C# class works, even if the files are added to a PCL (Portable Class Library) or .NET Standard 1.0 project. The problem is, that the produced code does not compile because the used PCL Profile 259 (same as .NET Standard 1.0) is missing some required classes and reflection methods. To fix the compiler errors, you have to provide the missing types and methods in your assembly. To avoid name collisions with potential client assemblies […] Read more...

Tags: , , , ,

.NET Core: Missing mscorlib after installing a Portable Class Library (PCL) or .NET Standard library

October 3, 2016, (updated on October 4, 2016), Software Development

.NET Core projects can reference Portable Class Libraries if one of the .NET Standard compliant profiles is used (e.g. the profile 259). However, after installing a PCL NuGet package in a .NET Core projects, you may end up with the following compiler error: The type '???' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. To fix this, just install the following PCL compatibility NuGet in your project: Microsoft.NETCore.Portable.Compatibility The package provides bindings for the missing “mscorlib” so that the project can be compiled without problems. Read more...

Tags: , , ,


  Page 1 of 1