Can I use Visual Studio to develop Mono applications? - linux

I have developed a .NET 4.5 application using WinForms. I want my application to run not only on Windows, but also on Linux, so I decided to port it to Mono.
However, I can't find any information on how to use Visual Studio for Mono. I don't want to switch to MonoDevelop, since VS provides much of the functionality I want and I am already familiar with it.
There apparently used to be something called Mono Tools for Visual Studio, which David Lively insists works on current VS editions, but I don't want to run an extension that was deprecated 3 years ago. I don't even know where to download the extension - it redirects to Xamarin, and Xamarin seems like not what I want because while it mentions VS integration, it forces me to install a bunch of Android and Java SDKs (why?).
As far as I can see, .NET and Mono code looks fairly similar, and there are 3 main concerns:
Making VS use the Mono compiler instead of the C# compiler, so I can tell if non-Windows users can compile my source, and also get notified about missing libraries
Making IntelliSense suggest only Mono-supported things
Making the "Run" command run the application using Mono, not .NET, so I can test it correctly
Is there really no easy way of accomplishing these?
Note: I want to develop Windows and Linux desktop apps, with a WinForms GUI or equivalent only. I am not interested in mobile.

In general, you can just target .NET 4.5 and compile with Visual Studio and the resulting assembly works as-is on Mono (assuming you don't use platform-specific stuff via p/invoke, etc).
Mono's WinForms support isn't perfect though (and nobody actively works on it), so you still need to test by running the app directly on Mono. Missing APIs aren't usually the problem, it's more that the Mono implementation has different behavior/bugs.
Another alternative to WinForms might be Xwt.

Related

Does Visual Studio 2022 have the same ability to open a javascript/nodejs project folder in a WSL2 Linux as VS Code is able to do?

If I'm in my WSL2 Ubuntu filesystem I can simply navigate to a javascript/nodejs folder and type code . to open that project folder and thanks to VS Code's Remote extensions, I'm essentially remoting into the Linux environment and ready to code.
Now Visual Studio 2022 has been released, I was wondering if it too supports the same level of cross-platform IDE capability as VS Code?
How, for instance, when in my WSL2 Ubuntu project in Windows Terminal, can I open my javascript/nodejs project in the Linux filesystem using VS2022, or is this not supported because VS Code is the only cross-platform IDE that can do this?
So its not really possible to do how your thinking. The problem here is that you your not understanding the difference between a "Code Editor", and an "Integrated Development Environment (IDE)", which is totally understandable, as the line that separates the two has become blurred in recent years, and also a topic of debate. There was a far more explicit distinction between the 2 10-15 years ago, however, Microsoft has done a good job at separating the two, where JetBrains will release a piece of software that can be used as an IDE, but is more often than not, used as an editor, but will still call it an IDE, even though its not an IDE in a pure sense.
How is all this related to your question?
When you open your Node.js project in VSCode via the code . command, you are opening it in an editor that implements Intelli-code, as well as a wealth of other tools, but essentially, the editor, and all the tools extract the names & file extensions of your documents, parse them (usually turning much of the info into an AST, where many extensions will make use of that info to offer the various tooling capabilities/features. The point is at the end of the day, the editor just parses all of your code, gives you info, and you make any changes as needed to your code. And again, this is what your doing with code .
With Visual Studio 2022, you can't open a project with it, unless its a project type the IDE supports, and enables the IDE, to embed its-self into your project. This includes things like built in environment, built in cache, built in build system, the files needed to bootstrap its-self. With an IDE, the IDE is part of the project.
So then why does Visual Stdio 2022 work with Node?
It works with node, to create Node.js applications within a windows environment, and it offers the ability to access different Windows SDK features via Node. These are things you could never do using server-side Linux builds with Node. When you build a Cpp application for windows, you package the entire thing in a .sin file, I haven't built a windows app in node, but I know that Node also uses the .sin file build system, which requires Visual Studio & Windows SDK to do, and parts of Visual Studio/Windows to be embedded into the project, for the project to be able to work in a Windows OS, and take advantage of MS Windows features.
Long story short, V.S. Code is the right tool for what your doing, why would Microsoft invest in two identical tools any way? If you ever want to build something for Windows, or for MS mobile device using Node, you will probably want to change your environment, to VS2022.

Is there a cross platform desktop framework that would utilize native libraries such at .NET and Cocoa?

I am starting a project that is heavily graphics related (think, paint app with layers).
Anyway, I have a long history in C#, Java, JavaScript and Ruby. This application will be open source.
But what I'm looking for is a "build once, use everywhere" framework. Most of the platforms I've looked into either seem to be far too outdated, too complicated, or just not a right fit.
I've looked into Swing, WindowBuilder, wxRuby, etc. So many choices and none seem modern enough, have good documentation, etc.
I was a C# desktop developer for years so if I were targeting Windows only, I would go that route easily. But I want my app to run on Macs too. But, I would like the Mac version to look like it was designed for a Mac and the Windows version designed for Windows, etc. I'm looking at the Mono Project currently. But the idea of my Mac users installing Mono doesn't appeal to me.
Anything Ruby based would be cool but not required.
Anyway, what are some recommendations? I use NetBeans, Eclipse and Visual Studio. So I'm not concerned with learning new IDE's if I had to. I even thought about doing it all in JavaScript and using the canvas but since I need to work with large, local binary files, I didn't know if that would be a good option.
Thanks for any suggestions.
Real Studio can create cross-platform desktop apps for OS X, Windows and Linux. It can also create Cocoa apps and you can use it to interface with Cocoa directly when needed.
However, Real Studio creates Win32 apps, not .NET apps so you cannot directly interface with .NET libraries.

Portable(in USB drive) C# CRUD apps

I need to write app from C# that do CRUD with database.and also it shuld look up for .net framework and install it if particular pc doesn't have it.user must be able to do crud things from the place he finished in previous computer
can you suggest me:
Database to use
Any class libraries for this
Any special considerations
I m using vs 2010 with .net framwork 4
A bit offtopic:
Actually "portable app" philosophy mean not only it could run without any installation process but also it will not leave any trails after itself. It including various frameworks installation.
To avoid any installations or registry trails - check portableapps.com, they have pretty neat toolset to make any app portable. They have Java-vm solution for sure, don't remember about .NET solution.

Develop Windows applications with Linux tools

I like the Linux operating system and vim editor, but there are many companies that develop under Windows environment in Visual studio etc. There is a possibility that I will have to work for such a company in about a month.
I'd like to do my work on my Linux system and copy the files to them. I have experience with both developments and I found out that I don't want to work with MS products but I like programming and writing MS code is not such a pain.
Are you a similar developer? Could you give me some advice about your methodology to be most of the time on Linux platform, to create code and debug everything in vim on Linux and only when neccessary open Visual Studio with Windows forms and similar things and test the things that weren't possible to test in Linux environment?
I would see the work in creating small peaces of code on Linux, testing them and then move it to MS platform and integrate to the whole system. How do you debug and test your code? The development will be probably in C# or C++. I can't imagine Visual Basic.
Please write here your experience, style of work, if this has sence or there are too many troubles and I should rather give up.
So the question is: How to develop applications that run on Windows with Linux tools, without touching Visual Studio and browsing with Windows file manager etc.
thank you
Not sure, if this will help you or not but there is a Vim Emulation layer for Visual Studio 2010 called VsVim.
Check out : http://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329
If I were you I'd install MinGW or Cygwin on your windows machine and just use gvim/vim anyway (or maybe just use the Win32 vim).
VS is just a big editor. You'll be building with the microsoft compilers ( perhaps using msbuild or nmake ) but probably are going to have to accept that you can only debug windows things with VS ( unless you build for MinGW or Cygwin and use gcc and gdb)
You can use vim as a code editor, you can even stick on Linux when developing software for the .NET platform. The people behind the Mono make this happen. Mono is a software platform designed to allow developers to easily create cross platform applications. It is an open source implementation of Microsoft's .Net Framework based on the ECMA standards for C# and the Common Language Runtime.
You can stick to the editor of your liking and use the tools that come with Mono to compile your stuff. There is a IDE called Mono Develop, but compared to Visual Studio it is pretty basic... and compared to VIM it lacks simplicity.
C# projects are plain text files so it's easy enough to edit them over an SMB share in whatever editor you wish from anywhere the sysadmins let you.
Testing however will be difficult without going back to the windows machine, and while Mono implements the framework, it's still a different environment if you're targeting Windows.

How to run C# 4.0 app on Linux OS using mono?

I want to run my c# application with OS Linux using Mono. I am new to this cross platform migration? Please tell the procedure for doing that?
Thanks & Regards.
It very much depends on what type of application it is. For a console or WinForms app, it may be simple. Mono doesn't support WPF.
Well, the first think you'll need to do is install Mono of course. Then you probably want to run MoMA to determine your application's compatibility. There's a whole separate page about porting WinForms apps.
If all is well, you should just be able to run your application using:
mono MyApplication.exe
after copying the binaries over.
If your application is actually a web service or web application, you'll want to think about the various hosting options.
I suspect you'll want to read a lot of the pages on the Mono Start Page.
Check if your application is 100% compatible with Mono Framework using MoMA.
Remove or replace those unimplemented parts with Mono's implementation or third party libraries that works with Mono. Or if you think it should work fine, just execute it with Mono Framework 2.8 or higher. Better go with 2.10 which is default's profile is on 4.0.
There is an IDE, MonoDevelop that supports Web and Desktop applications. Open the project files (monodevelop supports visual studio project files) from monodevelop, compile and run.
you can browse mono website here, where you can find which features are supported and which are not supported and why.

Resources