Handling projects in VS.NET 2003/2005

Home
Back To Tips Page

I recently ran into a problem where I had to maintain a set of projects in both VS.NET 2003 and VS.NET 2005.  After struggling with this for a couple hours, I came up with a solution that seems to work.  It is far from idea, because it involves having to maintain two copies of the project, but other than that (considerable!) defect, it compensates for Microsoft's inability to have solved this problem adequately.  They still live in a delusional world in which the day on which a new product is released, all users instantly switch from the old version to the new version, and never find any problems that would require that they revert to the older system.  Or have to maintain configurations that support both old and new builds.  In the past, they were much better about this; but in the VS.NET2003-to-VS.NET 2005 transformation they completely lost the concept of backward compatibility, since the new system uses the same file names as the old system!

In particular, I needed to use the VS.NET 2005 support to build 64-bit applications (this is what the client would be using to build the 64-bit app, so I had to conform to that need.  On the other hand, they did not wish to transition all their developers to using VS.NET 2005, partly because of its reputation for slowness, and part because of an inherent and well-justified distrust of any pre-Service Pack 1 software)

I spent some hours fiddling with this and came up with a solution.  Here are the steps I used.

We are starting with a simple solution that has only one project.

We are starting with solution file is called project.sln and the project file project.vcproj.

  1. Rename project.sln to project.2003.sln.

  2. Rename project.vcproj to project.2003.vcproj

  3. Copy project.2003.sln to project.2005.sln (in the same directory)

  4. Copy project.2003.vcproj to project.2005.vcproj (in the same directory)

  5. Invoke Visual Studio .NET 2005.

  6. Open the solution called project.2005.sln

  7. VS.NET 2005 will prompt to convert this project.  Do so, and tell it not to bother to make a backup (your .2003. files are the backup)

  8. In my case, I added the Win64 configurations.

  9. Note the Configuration Properties, General, Output Directory and Intermediate Directory properties of the Win64 configuration is $(PlatformName)\$(ConfigurationName).  Highlight one of these and copy it to the clipboard.

  10. Note, however, that for the Win32 configurations, these properties are simply set to Debug.

  11.  
  12. Paste the target descriptions into the Win32 configuration

  13. Repeat this process for each of the Win32 configurations, such as Release, and any others that you have.

The result is a build tree set (for my project) that looks like this

...\project
      |
      +--- project.2003.sln
      +--- project.2005.sln
      |
      project
        |
        +---project.2003.vcproj
        +---project.2005.vcproj
        +---*.cpp, *.h, etc.
        |
        +---res
        |    |
        |    +---*.ico, *.cur, etc.
        |
        +---Debug
        |     |
        |     +---*.obj etc. built by VS2003
        |     +---project.exe built by VS2003
        |
        +---Release
        |     |
        |     +---*.obj etc. built by VS2003
        |     +---project.exe built by VS2003
        |
        +---Unicode Debug
        |     |
        |     +---*.obj etc. built by VS2003
        |     +---project.exe built by VS2003
        |
        +---Unicode Release
        |     |
        |     +---*.obj etc. built by VS2003
        |     +---project.exe built by VS2003
        |
        +---Win32
        |     |
        |     +---Debug
        |     |     |
        |     |     +---*.obj etc. built by VS2005
        |     |     +---project.exe built by VS2005
        |     |
        |     +---Release
        |     |     |
        |     |     +---*.obj etc. built by VS2005
        |     |     +---project.exe built by VS2005
        |     |
        |     +---Unicode Debug
        |     |     |
        |     |     +---*.obj etc. built by VS2005
        |     |     +---project.exe built by VS2005
        |     |
        |     +---Unicode Release
        |           |
        |           +---*.obj etc. built by VS2005
        |           +---project.exe built by VS2005
        |
        +---Win64
              |
              +---Debug
              |     |
              |     +---*.obj etc. built by VS2005
              |     +---project.exe built by VS2005
              |
              +---Release
              |     |
              |     +---*.obj etc. built by VS2005
              |     +---project.exe built by VS2005
              |
              +---Unicode Debug
              |     |
              |     +---*.obj etc. built by VS2005
              |     +---project.exe built by VS2005
              |
              +---Unicode Release
                    |
                    +---*.obj etc. built by VS2005
                    +---project.exe built by VS2005

To build under VS.NET 2003, open the project.2003.sln file; to build under VS.NET 2005, open the proejct.2005.sln file.

Of course, the obvious problem here is that I now have to maintain two project files, but I can build all twelve configurations.easily.  Four builds (debug, Unicode debug, release, and Unicode release) built with VS.NET 2003, four 32-bit builds (of the same designations) built by VS.NET 2005, and four 64-bit builds (of the same designations) built by VS.NET 2005.

[Dividing Line Image]

The views expressed in these essays are those of the author, and in no way represent, nor are they endorsed by, Microsoft.

Send mail to newcomer@flounder.com with questions or comments about this web site.
Copyright 1999-2003 The Joseph M. Newcomer Co. All Rights Reserved.
Last modified: May 14, 2011