mercredi 5 juillet 2017

In NetStandard 1.3: Error CS0117 'Assembly' does not contain a definition for 'GetEntryAssembly'

I tried to use this code in a NetStandard 1.3 class library:

    foreach (Type mytype in System.Reflection.Assembly.GetExecutingAssembly().GetTypes()
    .Where(mytype => mytype .GetInterfaces().Contains(typeof(myInterface)))) {
        //do stuff
     }

but a compilation error is raised:

    Error   CS0117  'Assembly' does not contain a definition for 'GetExecutingAssembly'

I reached What is the equivalent of Assembly.GetEntryAssembly() in .NET Core?, but it can't help.

I know that this service may be available in NetStandard 2, but until it's released(it's now in preview):

What is the modification to be done to the above code to support NetStandard 1.3





Aucun commentaire:

Enregistrer un commentaire