Upgrade the old VS.NET 2003 project!

I finally accomplished to migrate the old project that is based on Visual Studio.NET 2003. It is built with the Visual Studi0 2013 now.

I need to fix some codes and project’s settings for the migration. Fortunately, almost codes work well, and the application built by Visual Studio 2013 runs without problems. It must be successful.

TL;TR

  • It needs to suppress warnings for using non-secure string function
  • It needs to suppress warning for the text encoding conflicts by differences between literals and source codes.
  • It requires some predefined macros for 32 bits time functions.
  • It needs to change the project setting, wchar_t as a native type, to resolve the unresolved function linking.

Full story

The most difficult part of compiler migration from VS.NET 2003 to VS 2013 was porting library that is mixed with codes for Unix, Windows, Unicode, and MBCS.

At this time, I set aside some build configurations for Unix and Unicode. Because our system is for MBCS and runs on Windows, supporting neither Unicode nor Unix is necessary.

  • Changes by platform SDK do not cause a big problem.
  • Some (explicit) type cast like pass int variable to time function makes program crashed, but it was detected by test case. Thanks, test cases.

USE CONVERSION WIZARD

The most important thing I recommend is that you should reply on Visual Studo Conversion Wizard.

Create a new solution and add the old project into the new solution. VC++ will convert a project to a new project for VS2013 preserving almost compiler and linker options.

PORTABILITY

Making codes supporting all of Unicode, MBCS, 32 bits, and even 64 bits is not easy.

It requires many of conditional compilations and predefined macros like version of platform SDK and compiler. You need a deep understanding of a system and the Visual Studio C++ compiler.

Focus on what you need.

SUPRESS WARNING

Suppress warnings for known issues and focus on more important.

Using non-secure string function is not so urgent that it does not need to fix right now. Your program works well without secured string functions as long as you do not use strcpy instead of strncpy. If you do so, it is time to change strcpy to strncpy, but not secure string functions.

Instead, focus on more important warning about explicit type casting. Platform SDK for VS.NET 2003 defines time function works with 32 bits but in VS 2013, time functions implemented for 64 bits. If you use explicit type casting for time function, your program will crash.

LEGACY LIBRARY

I removed legacy libraries built for VS.NET 2003 with conditional build configuration. Because I build release build for live version with legacy compiler, VS.NET 2013, they remain only at the debug build

With VS 2013, I will not build all of legacy libraries until I found one built for VS2013.

WINDOWS SDK

Changes of Platform SDK also causes some build error. Almost errors can be fixed by adding missed header files. In my case, there is no big problem.

LEGACY CODES

Fix them.

  • Old fashion to declare iteration variable of  for statement.
  • Old VC compiler allows using the const type parameter as a local variable.

WHAT’S MORE

Do not change everything.

Even though I switch compiler from VS.NET 2003 to VS 2013, I didn’t remove anything for VS.NET 2003, like codes, 3rd party library, and project settings. So, build server builds and deploys our project with VS.NET 2003, and the live system doesn’t recognize any difference.

FYI

I found useful information after I completed porting compiler. These articles will help you migrate your legacy C++ project.

Comments are closed.

Website Built by WordPress.com.

Up ↑