diff --git a/Build/netstandard2.0.props b/Build/netstandard2.0.props new file mode 100644 index 00000000..7fc79208 --- /dev/null +++ b/Build/netstandard2.0.props @@ -0,0 +1,49 @@ + + + + false + + + + $(Features);FEATURE_APARTMENTSTATE + $(Features);FEATURE_APPLICATIONEXCEPTION + $(Features);FEATURE_ASSEMBLY_CODEBASE + $(Features);FEATURE_ASSEMBLY_LOCATION + $(Features);FEATURE_ASSEMBLY_RESOLVE + $(Features);FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY + $(Features);FEATURE_BASIC_CONSOLE + $(Features);FEATURE_CODEDOM + $(Features);FEATURE_CONFIGURATION + $(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR + $(Features);FEATURE_DBNULL + $(Features);FEATURE_DRIVENOTFOUNDEXCEPTION + $(Features);FEATURE_DYNAMIC_EXPRESSION_VISITOR + $(Features);FEATURE_ENCODING + $(Features);FEATURE_EXCEPTION_STATE + $(Features);FEATURE_FILESYSTEM + $(Features);FEATURE_FULL_CONSOLE + $(Features);FEATURE_FULL_CRYPTO + $(Features);FEATURE_FULL_NET + $(Features);FEATURE_ICLONEABLE + $(Features);FEATURE_LCG + $(Features);FEATURE_LOADWITHPARTIALNAME + $(Features);FEATURE_METADATA_READER + $(Features);FEATURE_MMAP + $(Features);FEATURE_OS_SERVICEPACK + $(Features);FEATURE_PIPES + $(Features);FEATURE_PROCESS + $(Features);FEATURE_REFEMIT + $(Features);FEATURE_REGISTRY + $(Features);FEATURE_SECURITY_RULES + $(Features);FEATURE_SERIALIZATION + $(Features);FEATURE_SORTKEY + $(Features);FEATURE_STACK_TRACE + $(Features);FEATURE_SYNC_SOCKETS + $(Features);FEATURE_THREAD + $(Features);FEATURE_TYPE_EQUIVALENCE + $(Features);FEATURE_TYPECONVERTER + $(Features);FEATURE_WARNING_EXCEPTION + $(Features);FEATURE_WIN32EXCEPTION + $(Features);FEATURE_XMLDOC + + diff --git a/Dlr.sln b/Dlr.sln index 50bc3a04..fddb0c88 100644 --- a/Dlr.sln +++ b/Dlr.sln @@ -37,6 +37,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{60056F49 Build\net45.props = Build\net45.props Build\netcoreapp2.0.props = Build\netcoreapp2.0.props Build\netcoreapp2.1.props = Build\netcoreapp2.1.props + Build\netstandard2.0.props = Build\netstandard2.0.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Package", "Package", "{006DB050-2A71-4F36-BBE1-4AF6AF310C13}" diff --git a/Package/nuget/DynamicLanguageRuntime.nuspec b/Package/nuget/DynamicLanguageRuntime.nuspec index 3cd18415..e44d1636 100644 --- a/Package/nuget/DynamicLanguageRuntime.nuspec +++ b/Package/nuget/DynamicLanguageRuntime.nuspec @@ -24,6 +24,12 @@ + + + + + + diff --git a/Src/Microsoft.Dynamic/Debugging/DelegateHelpers.cs b/Src/Microsoft.Dynamic/Debugging/DelegateHelpers.cs index be787ac3..f9559304 100644 --- a/Src/Microsoft.Dynamic/Debugging/DelegateHelpers.cs +++ b/Src/Microsoft.Dynamic/Debugging/DelegateHelpers.cs @@ -25,7 +25,7 @@ internal static Type MakeNewCustomDelegateType(Type[] types) { TypeBuilder builder = DefineDelegateType("Delegate_" + Guid.NewGuid().ToString()); builder.DefineConstructor(CtorAttributes, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(ImplAttributes); builder.DefineMethod("Invoke", InvokeAttributes, returnType, parameters).SetImplementationFlags(ImplAttributes); - return builder.CreateType(); + return builder.CreateTypeInfo(); } private static TypeBuilder DefineDelegateType(string name) { @@ -49,4 +49,4 @@ private static ModuleBuilder GetModule() { } } } -#endif \ No newline at end of file +#endif diff --git a/Src/Microsoft.Dynamic/Generation/AssemblyGen.cs b/Src/Microsoft.Dynamic/Generation/AssemblyGen.cs index aeb44c99..f68d8ebf 100644 --- a/Src/Microsoft.Dynamic/Generation/AssemblyGen.cs +++ b/Src/Microsoft.Dynamic/Generation/AssemblyGen.cs @@ -346,7 +346,7 @@ public Type MakeDelegateType(string name, Type[] parameters, Type returnType) { TypeBuilder builder = DefineType(name, typeof(MulticastDelegate), DelegateAttributes, false); builder.DefineConstructor(CtorAttributes, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(ImplAttributes); builder.DefineMethod("Invoke", InvokeAttributes, returnType, parameters).SetImplementationFlags(ImplAttributes); - return builder.CreateType(); + return builder.CreateTypeInfo(); } } } diff --git a/Src/Microsoft.Dynamic/Generation/CompilerHelpers.cs b/Src/Microsoft.Dynamic/Generation/CompilerHelpers.cs index 899d28fb..9ea00635 100644 --- a/Src/Microsoft.Dynamic/Generation/CompilerHelpers.cs +++ b/Src/Microsoft.Dynamic/Generation/CompilerHelpers.cs @@ -620,7 +620,7 @@ public static T LightCompile(this Expression lambda, int compilationThresh return (T)(object)LightCompile((LambdaExpression)lambda, compilationThreshold); } -#if FEATURE_REFEMIT && !NETCOREAPP2_0 && !NETCOREAPP2_1 +#if FEATURE_REFEMIT && !NETCOREAPP2_0 && !NETCOREAPP2_1 && !NETSTANDARD2_0 /// /// Compiles the lambda into a method definition. /// diff --git a/Src/Microsoft.Dynamic/Generation/DynamicILGen.cs b/Src/Microsoft.Dynamic/Generation/DynamicILGen.cs index 8fde09fd..0ec4ab41 100644 --- a/Src/Microsoft.Dynamic/Generation/DynamicILGen.cs +++ b/Src/Microsoft.Dynamic/Generation/DynamicILGen.cs @@ -61,7 +61,7 @@ public override T CreateDelegate(out MethodInfo mi) { } private MethodInfo CreateMethod() { - Type t = _tb.CreateType(); + Type t = _tb.CreateTypeInfo(); return t.GetMethod(_mb.Name); } @@ -71,4 +71,4 @@ public override MethodInfo Finish() { } #endif } -#endif \ No newline at end of file +#endif diff --git a/Src/Microsoft.Dynamic/Generation/FieldBuilderExpression.cs b/Src/Microsoft.Dynamic/Generation/FieldBuilderExpression.cs index a319d4a3..f242b7d5 100644 --- a/Src/Microsoft.Dynamic/Generation/FieldBuilderExpression.cs +++ b/Src/Microsoft.Dynamic/Generation/FieldBuilderExpression.cs @@ -21,7 +21,7 @@ namespace Microsoft.Scripting.Generation { public class FieldBuilderExpression : Expression { private readonly FieldBuilder _builder; -#if NETCOREAPP2_0 || NETCOREAPP2_1 +#if NETCOREAPP2_0 || NETCOREAPP2_1 || NETSTANDARD2_0 private readonly StrongBox _finishedType; // Get something which can be updated w/ the final type. @@ -60,7 +60,7 @@ public override Expression Reduce() { private FieldInfo GetFieldInfo() { // turn the field builder back into a FieldInfo -#if NETCOREAPP2_0 || NETCOREAPP2_1 +#if NETCOREAPP2_0 || NETCOREAPP2_1 || NETSTANDARD2_0 return _finishedType.Value.GetDeclaredField(_builder.Name); #else return _builder.DeclaringType.Module.ResolveField( @@ -75,4 +75,4 @@ protected override Expression VisitChildren(ExpressionVisitor visitor) { } } -#endif \ No newline at end of file +#endif diff --git a/Src/Microsoft.Dynamic/Generation/ILGen.cs b/Src/Microsoft.Dynamic/Generation/ILGen.cs index f6df3890..93295f97 100644 --- a/Src/Microsoft.Dynamic/Generation/ILGen.cs +++ b/Src/Microsoft.Dynamic/Generation/ILGen.cs @@ -251,7 +251,7 @@ public virtual void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[] option _ilg.EmitCall(opcode, methodInfo, optionalParameterTypes); } -#if !NETCOREAPP2_0 || NETCOREAPP2_1 +#if !NETCOREAPP2_0 && !NETSTANDARD2_0 /// /// Emits an unmanaged indirect call instruction. /// diff --git a/Src/Microsoft.Dynamic/Generation/Snippets.cs b/Src/Microsoft.Dynamic/Generation/Snippets.cs index 935140d6..3ffc67a4 100644 --- a/Src/Microsoft.Dynamic/Generation/Snippets.cs +++ b/Src/Microsoft.Dynamic/Generation/Snippets.cs @@ -197,7 +197,7 @@ public Type DefineDelegate(string name, Type returnType, params Type[] argTypes) MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed); tb.DefineMethod("Invoke", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual, returnType, argTypes).SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed); - return tb.CreateType(); + return tb.CreateTypeInfo(); } diff --git a/Src/Microsoft.Dynamic/Generation/ToDiskRewriter.cs b/Src/Microsoft.Dynamic/Generation/ToDiskRewriter.cs index bf89067b..e088aa20 100644 --- a/Src/Microsoft.Dynamic/Generation/ToDiskRewriter.cs +++ b/Src/Microsoft.Dynamic/Generation/ToDiskRewriter.cs @@ -201,7 +201,7 @@ private bool ShouldRewriteDelegate(Type delegateType) { // SaveAssemblies mode prevents us from detecting the module as // transient. If that option is turned on, always replace delegates // that live in another AssemblyBuilder -#if NETCOREAPP2_0 || NETCOREAPP2_1 +#if NETCOREAPP2_0 || NETCOREAPP2_1 || NETSTANDARD2_0 return true; // TODO: #else var module = delegateType.Module as ModuleBuilder; diff --git a/Src/Microsoft.Dynamic/Generation/TypeGen.cs b/Src/Microsoft.Dynamic/Generation/TypeGen.cs index dc2ab861..4c1bf68c 100644 --- a/Src/Microsoft.Dynamic/Generation/TypeGen.cs +++ b/Src/Microsoft.Dynamic/Generation/TypeGen.cs @@ -42,7 +42,7 @@ public override string ToString() { public Type FinishType() { _initGen?.Emit(OpCodes.Ret); - Type ret = TypeBuilder.CreateType(); + Type ret = TypeBuilder.CreateTypeInfo(); return ret; } @@ -84,4 +84,4 @@ public ILGen DefineMethodOverride(MethodInfo baseMethod) { } } } -#endif \ No newline at end of file +#endif diff --git a/Src/Microsoft.Dynamic/Microsoft.Dynamic.csproj b/Src/Microsoft.Dynamic/Microsoft.Dynamic.csproj index 25717ea2..4221919e 100644 --- a/Src/Microsoft.Dynamic/Microsoft.Dynamic.csproj +++ b/Src/Microsoft.Dynamic/Microsoft.Dynamic.csproj @@ -1,7 +1,7 @@  - net45;netcoreapp2.0;netcoreapp2.1 + net45;netcoreapp2.0;netcoreapp2.1;netstandard2.0; Microsoft.Scripting 859832320 ..\..\DLR.ruleset @@ -14,15 +14,20 @@ - + - + $(DefineConstants.Replace(';FEATURE_FILESYSTEM', '')) + + + + + all diff --git a/Src/Microsoft.Dynamic/Utils/ReflectionUtils.cs b/Src/Microsoft.Dynamic/Utils/ReflectionUtils.cs index a6ba606a..a1673f0e 100644 --- a/Src/Microsoft.Dynamic/Utils/ReflectionUtils.cs +++ b/Src/Microsoft.Dynamic/Utils/ReflectionUtils.cs @@ -687,7 +687,7 @@ public static StringBuilder FormatSignature(StringBuilder result, MethodBase met result.Append(' '); } -#if FEATURE_REFEMIT && !NETCOREAPP2_0 && !NETCOREAPP2_1 +#if FEATURE_REFEMIT && !NETCOREAPP2_0 && !NETCOREAPP2_1 && !NETSTANDARD2_0 MethodBuilder builder = method as MethodBuilder; if (builder != null) { result.Append(builder.Signature); diff --git a/Src/Microsoft.Scripting.Metadata/Microsoft.Scripting.Metadata.csproj b/Src/Microsoft.Scripting.Metadata/Microsoft.Scripting.Metadata.csproj index 0a16bab0..059ebea7 100644 --- a/Src/Microsoft.Scripting.Metadata/Microsoft.Scripting.Metadata.csproj +++ b/Src/Microsoft.Scripting.Metadata/Microsoft.Scripting.Metadata.csproj @@ -1,7 +1,7 @@  - net45;netcoreapp2.0;netcoreapp2.1 + net45;netcoreapp2.0;netcoreapp2.1;netstandard2.0; 859832320 ..\..\DLR.ruleset $(OutputPath)\$(TargetFramework)\$(AssemblyName).xml diff --git a/Src/Microsoft.Scripting/Microsoft.Scripting.csproj b/Src/Microsoft.Scripting/Microsoft.Scripting.csproj index 45ddd428..a092b941 100644 --- a/Src/Microsoft.Scripting/Microsoft.Scripting.csproj +++ b/Src/Microsoft.Scripting/Microsoft.Scripting.csproj @@ -1,21 +1,26 @@  - net45;netcoreapp2.0;netcoreapp2.1 + net45;netcoreapp2.0;netcoreapp2.1;netstandard2.0 857735168 ..\..\DLR.ruleset $(OutputPath)\$(TargetFramework)\$(AssemblyName).xml - + - + + + + + + all diff --git a/Src/Microsoft.Scripting/Utils/DelegateUtils.cs b/Src/Microsoft.Scripting/Utils/DelegateUtils.cs index 50ecce6a..302dc1c2 100644 --- a/Src/Microsoft.Scripting/Utils/DelegateUtils.cs +++ b/Src/Microsoft.Scripting/Utils/DelegateUtils.cs @@ -66,8 +66,8 @@ internal static Type EmitCallSiteDelegateType(int paramCount) { MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed); tb.DefineMethod("Invoke", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual, typeof(object), paramTypes).SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed); - return tb.CreateType(); + return tb.CreateTypeInfo(); } } } -#endif \ No newline at end of file +#endif diff --git a/Src/Microsoft.Scripting/Utils/NativeMethods.cs b/Src/Microsoft.Scripting/Utils/NativeMethods.cs index 542dfd75..b0ca5b36 100644 --- a/Src/Microsoft.Scripting/Utils/NativeMethods.cs +++ b/Src/Microsoft.Scripting/Utils/NativeMethods.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -#if FEATURE_NATIVE || NETCOREAPP2_0 || NETCOREAPP2_1 +#if FEATURE_NATIVE || NETCOREAPP2_0 || NETCOREAPP2_1 || NETSTANDARD2_0 using System; using System.Runtime.InteropServices; @@ -15,4 +15,4 @@ internal static class NativeMethods { } } -#endif \ No newline at end of file +#endif diff --git a/Tests/Microsoft.Dynamic.Test/TestReflectionServices.cs b/Tests/Microsoft.Dynamic.Test/TestReflectionServices.cs index 2ce33f29..4653a79c 100644 --- a/Tests/Microsoft.Dynamic.Test/TestReflectionServices.cs +++ b/Tests/Microsoft.Dynamic.Test/TestReflectionServices.cs @@ -84,7 +84,7 @@ public void TestExtensionMethods1() { "DefaultIfEmpty", "ElementAt", "ElementAtOrDefault" }).ToList(); -#if !NETCOREAPP2_0 && !NETCOREAPP2_1 +#if !NETCOREAPP2_0 && !NETCOREAPP2_1 && !NETSTANDARD2_0 names.AddRange( new string[] { "AsQueryable", "AsQueryable", "AsParallel", "AsParallel", "AsParallel", "AsOrdered",