Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Roslyn运行时使用Linq=>;编译脚本;错误CS0012:类型';ValueType';在未引用的程序集中定义_C#_Roslyn - Fatal编程技术网

C# Roslyn运行时使用Linq=>;编译脚本;错误CS0012:类型';ValueType';在未引用的程序集中定义

C# Roslyn运行时使用Linq=>;编译脚本;错误CS0012:类型';ValueType';在未引用的程序集中定义,c#,roslyn,C#,Roslyn,我正在使用Roslyn编译器运行时编译C#脚本(.NET4.8项目)。 一旦脚本包含Linq表达式,就会出现以下编译错误: Compiler Error => ./scripts/65c2ea54b62241f49b7bf1a3f486bd01.cs(395,25): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to

我正在使用Roslyn编译器运行时编译C#脚本(.NET4.8项目)。 一旦脚本包含Linq表达式,就会出现以下编译错误:

Compiler Error => ./scripts/65c2ea54b62241f49b7bf1a3f486bd01.cs(395,25): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
我不确定如何添加相应的“netstandard”引用来解决编译错误。 我试图补充:

compilation.AddReferences(MetadataReference.CreateFromFile(Assembly.Load("netstandard, Version=2.0.0.0").Location));
但这在以下方面失败:

Could not load file or assembly 'netstandard, Version=2.0.0.0' or one of its dependencies

我认为您需要System.ValueTuple.dllI确实引用了ValueTuple-这与ValueType有关,似乎需要不同的引用您是否需要对netstandard.dll 2.0.0.0的引用?我认为您需要System.ValueTuple.dllI确实引用了ValueTuple-这与ValueType有关,似乎需要不同的引用是否有对netstandard.dll 2.0.0.0的引用?