5

I'm working on a project that means that I will need a Raspberry Pi; however, I have very limited programming experience in Python or Lua.

Is it possible to run a program compiled in VS2013 using C# on a Raspberry Pi?

Ant P
  • 24,820
  • 5
  • 68
  • 105
Cjen1
  • 1,826
  • 3
  • 17
  • 47
  • i think you can run c# program using mono: http://www.mono-project.com/ – tom.maruska Jan 09 '15 at 12:18
  • 1
    Look at http://stackoverflow.com/questions/10213600/mono-on-raspberry-pi for more QnA on Mono on Raspberry Pi. And this: http://logicalgenetics.com/raspberry-pi-and-mono-hello-world/ – noocyte Jan 09 '15 at 12:19
  • 1
    Is it a complicated project with strict time frames? If not, why not use the opportunity to learn another language? It may be fun :) – Steve Jan 09 '15 at 12:21
  • I may kinda need it done for next week but I'll probably need to learn python for some other part of it – Cjen1 Jan 09 '15 at 12:31

5 Answers5

5

You can use VS2019 to compile your C# application to .NET Core 3.1. Once your application is compiled open the directory with the .csproj file in command promt. type in dotnet publish -c release -r linux-arm in command promt. put the compiled files onto the pi then open a terminal window on the py and type chmod u+x <YourProjectName> then ./<YourProjectName> Enjoy!

Quinch
  • 141
  • 1
  • 3
  • 3
3

You can run Mono on your Pi, then develop in C# if you want.

http://www.raspberry-sharp.org/eric-bezine/2012/10/mono-framework/installing-mono-raspberry-pi/

Loofer
  • 6,841
  • 9
  • 61
  • 102
1

Yes, although you have to use the mono framework to basically emulate .net, it works for most method calls but not all. Have a look at

http://logicalgenetics.com/raspberry-pi-and-mono-hello-world/

  • 1
    This is outdated. You only have to install .NET Core in the Linux system, compile your C# that side, and run it like a normal app. No direct interaction with `mono` required. You never even see it. I've done this on a Debian VM, not yet on the Pi, but very likely it will work. Looking at the date of this answer, Blazin is uninformed. He really should have mentioned this, as it was already well known but not RTM yet. – ProfK Oct 20 '16 at 04:50
1

You can install Windows 10 IoT: https://learn.microsoft.com/en-us/windows/iot-core/tutorials/rpi

Or supported Linux and last version of .NET or .NET Core https://www.raspberrypi.com/software/operating-systems/

mainmind83
  • 491
  • 4
  • 7
0

If you install the mono framework and follow their guidelines there's no reason your application won't run (obviously within the limits of the framework and hardware). There are quite a few resources on it. I've seen it done in a demo without too many problems.

Writing on the pi would be harder!

Liath
  • 9,913
  • 9
  • 51
  • 81