编译S7netplus遇到的问题

编译时遇到两个报警,这里记录一下:

报警信息:

The current .NET SDK does not support targeting .NET Standard 2.0.  Either target .NET Standard 1.6 or lower, or use a version of the .NET SDK that supports .NET Standard 2.0.

解决方案:

https://dotnet.microsoft.com/download/dotnet-core 

到以上网址下载.NET Core 2.0(目前2.0已经停止支持,截至成文,最先版本是3.1)

相关问题可以看这篇回答:https://stackoverflow.com/questions/45732236/the-current-net-sdk-does-not-support-targeting-net-standard-2-0-error-in-visua

 

报警信息:

unable to locate repository containing directory during dotnet build or publish

在dotnet构建或发布期间无法定位包含目录的存储库

解决方案:

选中S7net项目--右键--Edit S7.net.csproj--注释掉下面两行

 

相关问题可以看这篇回答中Paul的回复:https://stackoverflow.com/questions/53696116/unable-to-locate-repository-containing-directory-during-dotnet-build-or-publish

 

使用S7.netplus可以用Nuget,也可以到GitHub下载源码自己编译。这里我用的是第二种方式,原因是在使用第一种方法引用S7.net.dll后,调用plc.ReadBytes()方法,该方法返回一个byte[],没有在dll中找到能够将S7数据类型转换成C#数据类型的方法。但想到ReadBytes()方法是其他Read方法的基础,通过查看S7.netplus源码,发现这些方法其实是有的,都保存在Types文件夹中,所以考虑自己编译源码来进行引用。

 

posted @ 2020-06-29 20:31  旋转的地球  阅读(1417)  评论(0编辑  收藏  举报