johara
johara

Reputation: 111

Rewriting C# from .net 4.5.2 to .net 2.0

I have written a few toy projects in C# using Visual Studio 2015 RC and the Winforms project template. I am trying to get my employer to use these to improve on the current Excel docs that are being used and for another process that we don't currently have a tool for.

The target machines are running Windows XP which only seems to support .Net 2.0 and I had chosen to use .Net 4.5.2, as a result the apps will not run. I have searched Google and stackoverflow, but the answers I can find only seem to reference scaling the .Net version up and not down.

Is there a more simple way of "converting" the projects from v4 to v2 than needing to design the GUI's again etc?

Upvotes: 1

Views: 298

Answers (1)

Gregory A Beamer
Gregory A Beamer

Reputation: 17010

What version of Visual Studio will the developers be using? The same version as you or an older version?

If the same version, it is easy to fix: Open the solution and look at the properties of all projects. Reset the target framework to 2.0 on all projects and attempt to compile. Fix any errors, which will most likely be new features in .NET that 2.0 does not contain.

Older version? You have more work, as there are syntax tweaks (syntactical sugar) in each version of C#. The fastest way is switch framework locally, fix any issues, and then open the code in the same version of Visual Studio they are using. You will then go through another fix cycle to remove newer syntax.

A PITA? For sure, but not as bad as a friend of mine who inherited an ASP.NET web app where the source code left with the developer. ;-)

As for redesigning GUI, I am not sure what the issue here is, unless you are using new GUI elements not available in .NET 2/4. If so, you have to remove and use older counterparts. But anything completely incompatible should be found when changing Framework versions.

Upvotes: 2

Related Questions