Upgrading old Visual Studio Solutions

I recently had to upgrade some old Visual Studio 2003 (!) solutions and projects to Visual Studio 2010. I tried to do that just by opening the solution and let the conversion wizard to its job. I had some challenges with the web application projects, including the old style web services.

The first lesson was to delete the project.csproj.webinfo file, because it contains an invalid reference to the project file, e.g.

<VisualStudioUNCWeb>
    <Web URLPath = “http://localhost/ExportWS/ExportWS.csproj” />
</VisualStudioUNCWeb>

Since the web site hadn’t been created, this URL was invalid.

Then, after the conversion, in one solution, I got the following error when re-opening the solution:

The following Web projects must be converted to the new Web Site format. The conversion process will remove all source control binding and the project will not be under source control after migration.

And then:

One or more projects in the solution were not loaded correctly. Please see the Output Window for details.

The output window contained the following error:

Some of the properties associated with the solution could not be read.

It turned out that the solution file had been corrupted. There were two extra GlobalSections. First there were:

GlobalSection(TeamFoundationVersionControl) = preSolution
    SccNumberOfProjects = 12
    …
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
    Debug|Any CPU = Debug|Any CPU
    Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
    …
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
    HideSolutionNode = FALSE
EndGlobalSection

But then, were were two extra GlobalSections:

GlobalSection(TeamFoundationVersionControl) = preSolution
    SccNumberOfProjects = 12
   …
EndGlobalSection
GlobalSection(TeamFoundationVersionControl) = preSolution
    …
EndGlobalSection

After removing these using Notepad, the above errors went away.

In another solution, each time I opened it I got a dialog saying the web projects must be converted to the new format. I found the solution here: http://connect.microsoft.com/VisualStudio/feedback/details/334842/repeated-conversion-of-project-file

Error Upgrading Database Project Using Visual Studio 2010

I recently upgraded a database project (.dbp file) to Visual Studio 2010. All I got was an error saying “database project not converted” and “Illegal characters in path”. I turned out that the project file was in ANSI encoding and referred to files which had national characters (å, ä and ö). In these cases, the entries in the project file had special formatting:

Script = “|file name|lots of hexadecimal digits”

e.g.

Script = “|20060111 Update COUNTYCOUNCIL Götaland Shortname .sql|00320030003000360030003100310031002000550070006400610074006500200043004f0055004e005400590043004f0055004e00430049004c0020004700f600740061006c0061006e0064002000530068006f00720074006e0061006d00650020002e00730071006c”

What I did was to remove the vertical bars and the hexadecimal string, and saved the file with UTF-8 encoding. Then there was no problem upgrading it.