In the example below... instead of compiling for .Net "v4.0", what should be provided to compile a PCL library?
var compiler = new CSharpCodeProvider(new Dictionary<string, string>
{
{"CompilerVersion", "v4.0"}
});
From this perspective a Portable Class Library is simply a library that is compiled against a set of portable reference assemblies, instead of the implementation or reference assemblies for a specific framework.
You can see the path to the PCL reference assemblies if you create a PCL in Visual Studio, select the ".NET Portable Subset" reference in solution explorer, and look at the Path property in the properties window. (The path will be different depending on what set of platforms you target in the PCL).
Set the references that the compiler will use to all the DLLs in the PCL reference path, and the result should be a portable library. If there are references that are included by default (ie mscorlib), then you will also need to disable them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With