diff --git a/Modbus.Net/Modbus.Net.Standard/Modbus.Net.Standard.csproj b/Modbus.Net/Modbus.Net.Standard/Modbus.Net.Standard.csproj index 6561935..1f55f26 100644 --- a/Modbus.Net/Modbus.Net.Standard/Modbus.Net.Standard.csproj +++ b/Modbus.Net/Modbus.Net.Standard/Modbus.Net.Standard.csproj @@ -1,7 +1,7 @@  - netstandard1.5 + netstandard1.3 Modbus.Net Modbus.Net Modbus.Net diff --git a/Modbus.Net/src/Base.Common/BaseProtocal.cs b/Modbus.Net/src/Base.Common/BaseProtocal.cs index 29b9ad4..53816a6 100644 --- a/Modbus.Net/src/Base.Common/BaseProtocal.cs +++ b/Modbus.Net/src/Base.Common/BaseProtocal.cs @@ -47,7 +47,7 @@ namespace Modbus.Net } //自动寻找存在的协议并将其加载 var protocalUnit = - Assembly.Load(type.GetTypeInfo().Assembly.GetName()).CreateInstance(protocalName) as ProtocalUnit; + Activator.CreateInstance(type.GetTypeInfo().Assembly.GetType(protocalName)) as ProtocalUnit; if (protocalUnit == null) throw new InvalidCastException("没有相应的协议内容"); protocalUnit.Endian = Endian; Register(protocalUnit); diff --git a/Modbus.Net/src/Base.Common/ProtocalLinker.cs b/Modbus.Net/src/Base.Common/ProtocalLinker.cs index e2eaf34..5a244b0 100644 --- a/Modbus.Net/src/Base.Common/ProtocalLinker.cs +++ b/Modbus.Net/src/Base.Common/ProtocalLinker.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System; +using System.Reflection; using System.Threading.Tasks; namespace Modbus.Net @@ -112,7 +113,7 @@ namespace Modbus.Net { //自动查找相应的协议放缩类,命令规则为——当前的实际类名(注意是继承后的)+"BytesExtend"。 var bytesExtend = - Assembly.Load(GetType().GetTypeInfo().Assembly.GetName()).CreateInstance(GetType().FullName + "BytesExtend") as + Activator.CreateInstance(GetType().GetTypeInfo().Assembly.GetType(GetType().FullName + "BytesExtend")) as IProtocalLinkerBytesExtend; return bytesExtend?.BytesExtend(content); } @@ -126,7 +127,7 @@ namespace Modbus.Net { //自动查找相应的协议放缩类,命令规则为——当前的实际类名(注意是继承后的)+"BytesExtend"。 var bytesExtend = - Assembly.Load(GetType().GetTypeInfo().Assembly.GetName()).CreateInstance(GetType().FullName + "BytesExtend") as + Activator.CreateInstance(GetType().GetTypeInfo().Assembly.GetType(GetType().FullName + "BytesExtend")) as IProtocalLinkerBytesExtend; return bytesExtend?.BytesDecact(content); } diff --git a/Modbus.Net/src/Base.Common/TaskManager.cs b/Modbus.Net/src/Base.Common/TaskManager.cs index 0c3fcb1..245c661 100644 --- a/Modbus.Net/src/Base.Common/TaskManager.cs +++ b/Modbus.Net/src/Base.Common/TaskManager.cs @@ -116,7 +116,7 @@ namespace Modbus.Net /// private void NotifyThreadPoolOfPendingWork() { -#if NET45 +#if NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 ThreadPool.UnsafeQueueUserWorkItem(_ => #else ThreadPool.QueueUserWorkItem(_ => diff --git a/README.md b/README.md index ea699de..bb143b8 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ There are also "Modbus.Net.Siemens" that can communicate to Siemens S7-200, S7-2 Platform Supported ------------------- * Visual Studio 2017 -* .Net Framework 4.5 -* .Net Standard 1.5 +* .NET Framework 4.5 +* .NET Standard 1.3 ##RoadMap