Retargetable assembly references have been introduced for the .NET Compact Framework and are now used to support Portable Class Libraries.
Basically, the compiler emits the following MSIL:
.assembly extern retargetable mscorlib
{
.publickeytoken = (7C EC 85 D7 BE A7 79 8E )
.ver 2:0:5:0
}
How does the C# compiler understand it has to emit a retargetable reference, and how to force the C# compiler to emit such reference even outside of a portable class library?
The C programming language works by writing your code into an executable file. The C compiler will take that executable and convert it in its entirety into machine code that will then be executed by your computer at runtime.
An Arrow operator in C/C++ allows to access elements in Structures and Unions. It is used with a pointer variable pointing to a structure or union. The arrow operator is formed by using a minus sign, followed by the greater than symbol as shown below. Syntax: (pointer_name)->(variable_name)
For the assembly itself, it's an assembly flag, ie [assembly: AssemblyFlags(AssemblyNameFlags.Retargetable)].
Make note that this flag is meaningless outside of platform assemblies - custom assemblies cannot be retargetable.
For references, it's copied as part of the name from the assembly being referenced.
Not sure if this will help, but the following file was auto-generated and included in the build.
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(
".NETPortable,Version=v4.0,Profile=Profile4",
FrameworkDisplayName = ".NET Portable Subset")]
This might hint to the compiler to do some magic.
Edit:
I think above makes a library portable. From the command line I can see /nostdlib+
is used, and a portable mscorlib.dll
is referenced (which I assume has the same attribute as mentioned above).
"...\Program Files\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile4\mscorlib.dll"
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