I neeed to run a windows form application on Raspberry Pi made using C#.
I have tried the option of installing a windows os and running the exe application . It does work but the issue is that it is slow and takes a lot of time for the application to work.
Is there any possibility to run the exe directly on raspbian ?
You can't natively run winform applications under Linux, but maybe you could try using Wine or one of the other compatibility tools for Linux.
If you are the author of the application you could port your app to GTK# which is a desktop GUI Toolkit for Linux with C#
What I'm using right now:
You can execute Windows Forms Applications written in the .NET Framework (newest 4.8, no longer continued) with mono.
On the raspberry pi, if I recall correctly, you can "sudo apt install mono-complete" and then run it via the terminal: "mono YourApp.exe"
As I said, it sadly only works with .NET Framework Applications (or maybe on rare occasions with .NET 6.0 too, hasn't worked for mine though), you may be able to change that in Visual Studio though (or new project and then copy/paste the code).
The only downside is that you are then using an older version of C#, meaning some things may be different from what you are used to.
Related
I have developed a window forms application using visual studio 2017.
Now I want to install this window forms application on Mac os.
Please help in this connection. What easy possible way to do.
Thanks
If you have a complete app in WinForms on .NET Framework, you could try porting it to Mono, which is .NET Framework implementation for Linux and MacOS. You can check out this link.
It's a completely different story if you're running .NET Core. In that case I would suggest creating web UI in ASP.NET Core. Or if you're familiar with one of UI frameworks compatible with MacOS (e.g. Qml.Net or AvaloniaUI), build the frontend in it.
Hello, First at all winform are designed to run on windows only(BTW is really old technology of creating desktop application using C#). Much better approach is to use WPF.
In case of You want run Your application on different platforms is much better to use WPF on .NET CORE. The same application You can easy run on:
Windows, Mac OS, Linux
I hope this can help You.
Basically, my school only has Mac computers, however they're telling me to learn C# and to do so using Visual Studio. However, the school program is fairly new and the projects are self-guided. I've been coding in C# using Visual Studio and it's been working so far - it's run successfully and everything. However, I can't seem to find a way to export or publish my code into a standalone application. I've tried using WineBottler to convert the .exe into a .dmg, but I can't seem to make it work.
How should I do this? Moving to Windows or another IDE/compiler isn't an option. I've currently been creating my projects in a Console App, but I could change that if necessary.
After quite a bit of experimentation and research, I've found that while you can publish a .NET Core Console App within Visual Studio for Mac, the feature is not supported within the GUI of the program (for whatever reason).
In order to publish, you have to Control-Click on the solution in the Solution Explorer and open the project in the command line by clicking Tools > Open In Terminal.
Once there, type in the command:
dotnet publish -c Release --framework netcoreapp2.1 --runtime osx-x64
This will create a self-contained program for 64-bit mac os on the v2.1 .NET Core framework. The runtime can be changed for different operating systems and the version number for netcoreapp can be changed based on which version you're using and what is compatible with any plugins for your program.
The final product will be found in yourprojectfolder/yourprojectname/bin/Release/netcoreapp2.1/osx-x64/publish
You should have no issues creating and compiling .NET CORE console apps using a Mac. These apps will have limited .NET functionality, do not have .exe files, and are platform agnostic. Here is a quick guide you can reference to decide if .NET CORE is the right option for you.
If you are trying to create WinForm apps or something similar, you cannot do this on a Mac. There are "work arounds" using Wine or other tools, but my experience with those options has been suboptimal at best. If you need to create apps like this, then your best option is to program on a Windows machine. Perhaps ask your school to enable bootcamp and install Windows 10 OS on one of the Mac machines.
You can generate exe using the terminal if you are on OSX. You can follow this post
It requires :
Visual Studio For Mac
A .cs file
Few lines in terminal
I have windows 8.1 64 bit with visual studio 2013. But I want to develop C# application which will run on all Windows operating system xp,vista,7,8,8.1 32bit&64bit.
Is it possible to develop universal C# application for 32&64 bit xp,vista,7,8,8.1 OS.???
As pointed out in the comments, you can use .NET 4.0 to do this, and compile with Any CPU. Don't use 4.5 or later, as it's not supported on Windows XP.
You can even back-target your app all the way to the 2.0 runtime if you have a very simple application and you want to have the widest availability without having to install a later version of the .NET Framework on old machines. You give up a lot when you do this, though. I recommend just targeting 4.0 and being done with it.
I have years of experience developing on microsoft development stack primarily visual studio 2012/c#. But right now, im required to develop app on linux. While i know c++, its been years since i really touch that. I have few questions.
Can i develop using mono and compile binary for linux and windows with no code(or minimal) code changes?
Can i develop on windows platform using visual studio 2012, compile for linux on window platform? do i need to use virtual machine for compiling for linux in windows platform?
How do you setup your development environment if you want to develop linux app on windows platform(develop on windows, compile for linux and windows. my linux box use for testing is a separate machine.)
Some info on what im working on.
My project is about network channel analysis. The client is cheap industrial linux box most probably with no ui. Im using mono/c# to develop the client. The server would be windows develop using vs2012 c#. Most probably using wpf as ui. Im planning to share network/communication library between linux(client) and windows(server). My primary concern for using linux is for cost saving since the client is almost thousand units.
thank you.
Mono runs executables in PE (Portable Executable) format, the native file format of Windows. There's no need to "compile for Linux", as long as your app is pure MSIL. And even if you use native DLLs through p/invoke, Mono and Wine work together to run the Windows files on Linux.
(The a.out and ELF executable formats used by native Linux applications don't have mechanisms for storing .NET metadata, the PE format was modified to support .NET, so that's what .NET Framework (not Micro Framework) implementations use regardless of platform)
The most important things to consider at the beginning are,
WinForms of Mono is problematic. Not only most third party controls won't work properly, but also libgdiplus itself is not 100% compatible with Microsoft's GDI+. It might appear to be a sweet option, but later you might still need to fight hard against the incompatibilities.
WPF is not an option as Mono does not support it yet.
GTK# is your best choice for UI, which blends naturally with Linux distros. If you refactor your Windows project properly, you should be able to share the non-UI code between your Windows and Linux solutions. This is what Mono guys recommend (not only use native UI frameworks for Windows, Linux, but also for Mac/MonoMac, iOS/Xamarin.iOS, and Android/Xamarin.Android).
So go back to your questions,
You should never wish for no code change for a real world project. No, that's impossible. As I said earlier, you have a chance to share most non-UI portion.
You can develop the non-UI portion and the Windows only portion using VS2012 and test them out on Windows. If you plan to use Mono's WinForms or GTK#, you must develop and debug on Linux using MonoDevelop. Thus, you need either a virtual machine or physical machine of Linux.
For me, I frequently switch between Linux/MonoDevelop and Windows/VS.
As Mono + C# is much more productive than using C/C++, many successful Linux apps are developed on Mono, such as Banshee and Tomboy.
You can use Visual Studio without problems but for example you cannot use WPF, while Windows Forms are ok. For more information what you can use visit: http://www.mono-project.com/Compatibility
Moreover there exists Mono tools which integrates with VS: http://www.mono-project.com/GettingStartedWithMonoTools
I've got a relatively small ASP.NET project that was written using C# 4.0.
I was wondering if anybody had managed to port such a project over to running under a webserver on Linux, the latest information I can find appears to only have support for ASP.Net 2.0 - Configuring and running Mono ASP.NET 3.5 (AJAX.NET) on Linux computers
The project uses LINQ-to-SQL for the entire data access layer, and I know Mono itself support LINQ, so I thought it stands to reason that it should work.
I just want to know if it's a complete waste of time or not before starting.
Thanks.
I run an ASP.NET 4.0 application on Suse Linux using mono. My experience with mono is that it just works. My app is ~ 15.000 LOC and uses third party components like mongo-csharp-driver, lucene.net, elmah, munq, and sphorium.webdavserver.
I've had almost no compatibility problems during development - and the ones I had where easily worked out (for example sphorium accesses the registry; this obviously works different on Linux/Mono). I've even started developing with Visual Studio instaed of MonoDevelop and without the Mono plugin, because Visual Studio is a better IDE, and it just works when I compile my web app on linux and deploy it on Apache (even though I develop with .NET on Windows).
I've written a short blogpost on getting started with the setup
This is definitely not a waste of time. The company I work for converted our VB.Net application to C# so that it can run under mono. This application has over 200k lines of code. We now are running with Ubuntu/Apache/Mono/Postgresql on Amazon ec2.
The only concern I would have is with your database. If it is MS SQL then you will need to look at migrating to MySQL or Postgresql. Again we did this with 300+ tables and 900 stored procedures. It is definately something worthwhile in the long run.
I think that the best way to get started would be to setup a local environment running something like Ubuntu. You can get the near latest versions of mono from the repositories at http://badgerports.org/ or if you prefer you can the latest versions as build scripts which are maintained here. Install monodevelop and build your code on linux with mono. From experience the mono with C# is a pretty much a complete implementation of the .net framework. I would be surprised if there was something in your application that is yet to be implemented in mono.
I have an answer here showing an easy configuration for your application under apache. I use this configuration for mono applications running on Ubuntu.