upgrade program for converting vb6 app to C# - c#

What is the best pathway to achieve this?
I know that VS2005 contains an upgrade mechanism. Do any later versions of VS contain this?

Microsoft has devoted a site to VB6->.NET migration.
They recommend a Free tool from ArtInSoft.
However I'm not sure I'd like to maintain a .NET application written in VB6-style. But on the other hand a tool could give you a good start and you can refactor the result where the tool does not produce code of your liking.

In the latest release of Visual Studio, the VB6 Migration wizard is now missing from the IDE.
A good external tool to perform a migration is VBUC .

One way to do this, which was used successfully in one of my previous teams, is:-
use the free Microsoft tools for upgrading from VB6 to VB.NET (e.g. http://msdn.microsoft.com/sv-se/vbrun/ms788233)
compile the resulting code into assemblies
decompile the assemblies into C# using a tool such as .NET
Reflector, ILSpy, etc.
cover the code in unit tests
refactor until the code is managable (the initial code is likely to
be quite ugly)

Related

Which versions of which compilers I should use to have C# 9 compiler?

Here it was written that compilers of different versions are applied sequentially to build the latest version of compiler.
I don't want to use binaries provided by Microsoft. I want to have everything be compiled from source codes.
Which repositories I should compile exactly? Do they all have open source licenses?
The runtime and the compiler for .NET 5.0 are open-source. You can start by going to https://github.com/dotnet/runtime. However, building the runtime requires the compiler (which will be downloaded by running the build script). So there's little you can do to avoid getting binaries that were built by Microsoft. If you're afraid that they're fake (and in some way different from what you would get if you directly built everything from source) you'll probably have to go a different way.

Is Roslyn cross platform?

I've been looking at Roslyn for quite some time now, and I'm curious and excited about it. One thing I noticed is that they mentioned that the compiler is re-written in managed code. This raises the question of whether Roslyn is able to run on non-.NET virtual machines, such as Mono.
I would really love to embed C# scripting using Roslyn in my video games, and to use many of their other features in my applications, but I'm wondering if using Roslyn will break the ability for it to run on Mono.
Has anyone tried running Roslyn on Mono? Is it possible? Why or why not?
To clarify, I'm interested in both whether the managed assembly can run on Mono, and whether it can generate assemblies that mono can run.
Despite it being the furthest thing from Eric's mind, Roslyn has been released as true Open Source (Apache 2.0) and is in fact now cross-platform.
Miguel de Icaza of Xamarin showed it running on Mono at BUILD.
When Roslyn releases, it will become part of Mono. They are already maintaining a branch at the Mono Git repo.
As #Govert has already mentioned in a comment, if you want to embed C# scripting capabilities you should simply use the Mono-equivalent library/tool: Mono-Csharp. (Especially because, even if Roslyn could run on Mono, its licence may dictate that you're not allowed to.)
This tool in the Mono world has existed much earlier than Roslyn BTW, and is open source. Here you have even a Microsoft employee blogging about it and uploading it to Nuget:
http://blog.davidebbo.com/2012/02/quick-fun-with-monos-csharp-compiler-as.html
I hope your game will kick ass!

How to get round VC++ Runtime requirement in a dll?

I wrote a dll in VS2008 that I use in my C# application,but my users don't like the fact they need both .NET framework and VC++ Runtime.
Is there a way I could avoid the 'must-have' VC++ Runtime in my C++ dll?
You can build your dll with the runtime linked statically (/MT instead of /MD - Under properties->Configuration Properties->C/C++->Code Generation->Runtime Library).
You can link the static runtime library into your dll. This way it will always be there and no .dll with C++ runtime will be required.
Like others said, you can statically link, but that will become a nightmare if you ever incorporate 3rd party C++ dlls that are not statically linked (which is almost everything). That scenario will lead to random crashes that will take you forever to debug. The easiest thing to do is to use an installer which hides this from your users. You can use merge modules if you use the vs installer, or install as part of an nsis install. This will make everyone's life easier. Especially yours. There is no reason on should be against installing these anymore than one is against installing the .NET framework. It makes no difference in terms of stability unless you need them and don't have them.

Cross platform programming on Windows

Two Questions:
Is there any way to write cross platform programs on Microsoft Visual Studio?
If there isn't then could I write a C# application on VS2008 and recompile it with MonoDevelop and have it work?
1 - I dont' think so. Not without something like Mono.
2 - Yes you can, but Mono doesn't cover all the framework - they are working on it.
The best thing to do is check with the Mono Migration Analyzer. The Mono Migration Analyzer (MoMA) tool helps you identify issues you may have on Mono - http://mono-project.com/MoMA.
I have found most of my .NET 2.0 applications can be converted, but you may need some tweaks.
You can always use C++ and QT. Soon QT will be released on LGPL license (from version 4.5) that will give some more freedom.
The only limit of using free QT license is that you don't get integration with VS. However this can be handled by using eg. CMake (which will generate VS solution files).
Yes, Write your code, compile and run on another platform using Mono. When you compile you generate IL, which Mono can use. Note: Some functions aren't available on Mono. Delphi Prism, is an add on for Visual Studio which allows you to code to Linux and Mac from VS albeit in the object Pascal language though.
Yes, see same issues as in 1
I agree with Joe90, just one thing he left out: MonoDevelop can compile .sln and .csproj files because it has a MSBuild implementation.
So point MoMA at your code and if you get a green light it should compile as-is in MonoDevelop.
As a MSCLR junkie I have to admit that Mono has a few 'better' implementations of certain critical functions (mostly to do with encryption). You will get more usability power from these.
Another thing to watch out for is subtle logic errors. If a class is implemented in Mono it does not mean that it will behave the same the MSCLR one (Mono is a cold-room implementation and as such they DO NOT use the original source code). This is really where you will get good results from a well unit-tested code base.
For a good indication of what you should expect, I remember seeing a large amount of #if MONO in the AgsXMPP repository.
You could ideally write a C# application and have it run on the Mono platform. BUT, that will depend on the libraries of MS .NET that has been ported yet to Mono.
Just in case, there is no language constraint, you could consider using other languages like Java, Python, Ruby and the like..
Good Luck!
As many others mention your success will depend on the libraries you use. Mono does have Winforms but I would suggest that you also look at GTK# http://www.mono-project.com/GtkSharp as your windowing library. If you use GTK# you will use a library which is not reverse engineered (as Winforms is in Mono).
My understanding is that "non-gui" .NET 2.0 stuff is pretty much in place with the newest versions of Mono
You don't need mono develop, the whole idea of mono is you can develop for .net and have the same assemblies work on both mono and .net, provided you only use stuff which has been implemented in mono.
Stuff which won't work:
pinvoke,
wpf,
linq to SQL
Stuff which will work:
.net 2.0,
c# 3.0 (including linq to objects and linq to xml),
winforms
If you write your application in Silverlight, anyone with a web browser and the Silverlight plugin can access your app. This is as cross-platform as you're going to get with .NET.

Embedding .Net Runtime

Am I able to embed the .net runtime so that .net is not required on the host operating system? I was looking at doing this with Mono by looking here: http://mono-project.com/Embedding_Mono but seems to allude to using external modules to accomplish this. My goal is to have one single executable with no installed .net runtime. I do not know how this would be configured in my application to compile the native code, link the mono runtime- as well as compile the C# code and link that as well?
You can now statically compile Mono assemblies as was just demonstrated at PDC. The purpose of doing this was to allow .Net applications to run on the iPhone, but this should work anywhere.
There are some limitations to this; obviously, it can't depend on runtime-generated code, so Reflection.Emit is out.
Third-party solution i've used with much success: Xenocode
This is not currently supported, and AFAIK there are no plans to change that status.
There are some third party tools out there that try to do this for you, but last time I checked none were very good yet.

Categories