简体   繁体   中英

Windows .net program on PI 3

I wrote an "AI" style program on my laptop and it works for the most part. Laptop is running Windows 7 and it was written in VS2017. However i really don't want it to just live on my laptop so i thought i would buy a PI-3 and have it live there for home automation purposes. However in hindsight i read i cant dev Windows 10 Iot on a windows 7 laptop which is what i wrote the original program on. What is the best way to make this run on a PI. Not familiar enough with mono. I did try once to open my program in mono on my mac and some important things i wanted such as voice synthesis were not working properly. Any suggestions or guides would be appreciated.

I have successfully ported a major application (100 + Forms, attaching to database with 200+ tables and 500+ stored procedures) to the Pi running Raspbian via Mono. Like you I was rather optimistically tempted first to try copying the binaries across, as it was advertised to be binary compatible. It crashed immediately.

Fortunately I persevered. The first thing to do, is to get Mono Develop up and running on your Pi. Then create yourself small demo applications, that test each of the technologies that you need for your application. The Mono Develop debugger works just as Visual Studio, even down to using the same function keys. So it is very easy to find things that work, things that don't work and things that need a workaround. Once I had identified all this, I was indeed able to build binary compatible exes/dlls which run on both O/S. You may of course find that there is something missing which is a "deal-breaker".

Note that Mono Develop has no GUI designer for Winforms, so you are better off designing your forms in VS and then transferring the source code, for debug under Mono Develop. You can transfer the entire solution, as Mono Develop correctly reads a VS .sln file.

From my experience, some points to note:

  • Set your build to X86; you will have far fewer problems than Any.
  • DataGridView is fine for Read Only, but is broken for write (or at least it was in the last Mono release I used)
  • Make sure all your code is Managed c#. When using third party software, check for the same. I found several problems from third party software, that claimed to provide .Net libraries, but which were really just wrappers.
  • CultureInfo is poorly implemented. If you are happy with essentially a US-en locale, you should be fine. For foreign language support, you will have to provide your own in places.

In general I have been very impressed with the job that has been done by Mono. I have been able to connect my app on Pi to Windows Servers running MS SQL Server, PostgreSQL and Oracle, as well as hosting PostgreSQL locally. The speed of the Pi 3 running Raspbian is also impressive. I encourage you to give it a try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM