Porting .net application from windows to linux
I developed an application using VB .NET on a Windows OS. If I want to enable this开发者_如何学Python application for a client who uses Linux , how do I do so? Do they need to purchase VB .NET? I am totally lost on how this works.I have never worked on linux can anybody help.
Mono has full support for Windows.System.Forms, but not for WPF. Which means that your application will most likely work on Linux as long as Mono is installed.
There are however some things you need to know. For instance, if you are manually creating file paths you need to change that. You have Path.Combine
and Path.PathSeparator
to build paths.
You should also take care when it comes to new lines since windows uses \r\n
while linux uses \n
. Use Environment.NewLine
instead of hard coding \r\n
.
You have a Mono for developers page here: http://www.mono-project.com/Mono_For_.Net_Developers
The best of all is the migration analyzer: http://www.mono-project.com/MoMA which checks for all compability issues.
There are two options :
- Run the application with Mono
- Run the application using Wine
No need to recompile. I would first test the application with both and decide which one would take lesser efforts to fix resulting issues.
In your VB.Net application if you have not used any windows only proprietry stuff( Dllimport, COM components, native libraries etc.,) then you can try to copy the application as is to a linux machine with Mono and run it. Some of my applications has worked like this in the past. If it works out of the box then you don't need to bother compiling your app in the linux environment at all.
There are some pitfalls: The packaged mono-develop and compilers may be older ones and compiling them yourself ain't easy for the first time. Usually you get at least .NET 2.0 support.
On ubuntu you can install IDE and compiler as root with:
apt-get install monodevelop mono-vbnc
the rest should be pulled as dependencies.
You don't have to purchase VB.NET. What you need to do is to find out if your .NET application is compatible with mono. You can check your compatibility with MoMA and/or try to compile/run your application on linux with mono.
精彩评论