Where are MethodBuilder, ModuleBuilder, and AssemblyBuilder located in the dotnet core?

I am transferring the .Net Framework library to the .Net standard, and the compiler cannot find the main developers from System.Reflection.Emit .

If I'm in the right place, then the API documentation states that these collectors ( MethodBuilder , ModuleBuilder and AssemblyBuilder ) are part of System.Reflection.Emit .

This is project.json for my library:

 { "version": "1.0.0-*", "buildOptions": { "debugType": "portable" }, "dependencies": {}, "frameworks": { "netstandard1.6": { "dependencies": { "NETStandard.Library": "1.6.0" } } } } 

Do I need a sitelink?

+6
source share
2 answers

They can be found in the package "System.Reflection.Emit": "4.3.0" nugget for the netstandard1.6 framework.

+7
source

The answer "animalito maquina" also worked for me, but I did a little research on the problem using netstandard2.0. Perhaps this does not apply to this issue, but I would like to share this with you, since it can still help others :).

I created two projects (dotnet new):

  • "classlib" which uses netstandard2.0 by default
  • ... and "console" that uses netcoreapp2.0

I have added references to the AssemblyBuilder class in both projects. AssemblyBuilder was not present in the "classlib" project, which uses netstandard2.0, but was available in the "console" project - netcoreapp2.0.

The "problem" is because the .NET Core Libraries is always always a superset of the APIs defined in the corresponding version of the .NET Standard. There are always types and elements in .NET Core libraries that are not (yet?) Part of the .NET standard.

These links may be helpful:

+1
source

Source: https://habr.com/ru/post/1014743/


All Articles