2017-02-06 27 views
6

我正在将.Net Framework库迁移到.Net标准,编译器无法从System.Reflection.Emit找到核心构建器。dotnet核心中的MethodBuilder,ModuleBuilder和AssemblyBuilder在哪里?

如果我在正确的地方,然后API文档指出,这些制造商(MethodBuilderModuleBuilderAssemblyBuilder)是System.Reflection.Emit一部分。

这是project.json为我的图书馆:

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

我是否需要任何额外的参考?

回答

7

你可以在"System.Reflection.Emit": "4.3.0"的netstandard1.6框架的nugget包中找到它们。

+0

为我工作。我不知道为什么这是downvoted ... –

0

“animalito maquina”答案也适用于我,但我已经使用netstandard2.0调查了一下这个问题。这可能与这个问题没有关系,但我想与你分享,因为它仍然可以帮助其他人:)。

我产生两个项目(DOTNET新):它使用netcoreapp2.0

  • “CLASSLIB”,它在默认情况下
  • 使用netstandard2.0 ......和 ​​“控制台”

我在两个项目中都添加了对AssemblyBuilder类的引用。 AssemblyBuilder在使用netstandard2.0的“classlib”项目中缺失,但在“console”项目 - netcoreapp2.0中可用。

的 “问题” 是一个事实,即.NET Core Libraries are actually always a superset of the APIs defined in the corresponding version of the .NET Standard. There are always types and members available in the .NET Core Libraries, which are not (yet?) part of the .NET Standard.

这些链接可能会有所帮助引起