Alex Rivera | Logout

Working with multiple versions of Visual Studio

Asked 2011-02-23T08:10:59.047
16

I'm trying to find a way of being able to use multiple versions of Visual Studio on the same set of projects. The majority of our team uses 2008, but I am trying out 2010. All projects are C#.

As I understand it Visual Studio 2010 insists on upgrading all projects, so it's not possible to leave all the solution/project files as 2008 versions. I really don't want to branch the entire source tree, so I'd like to find a way for multiple versions of the project files coexisting. Currently, I've duplicated all .sln and .csproj files so I have:

# 2008 versions
SolutionName.sln
ProjectA.csproj
ProjectB.csproj

# 2010 versions
SolutionName.vs2010.sln
ProjectA.vs2010.csproj
ProjectB.vs2010.csproj

The trouble is, despite the 2010 versioned files all having the same assembly names as their 2008 counterparts, Visual Studio (2010) believes the projects are all ProjectName.vs2010. Renaming the project in VS fails with a message saying a file of the same name already exists.

I don't think putting the 2010 version in a sub-folder would be a solution as it would screw up any relative paths in the files.

So:

  • Is there any way to convince VS that the project name should not be suffixed with .vs2010 (i.e. not the same name as the file)? Or
  • Am I approaching this the wrong way? Is there a better way of working with multiple versions of VS on the same projects?

UPDATE

My initial claim was wrong that Visual Studio was failing to find the project references because it was using the file name. The specific problem I was having was that in my build files the project references were of the form:

<ProjectReference Include="..\..\path\to\ProjectName.vs2010.csproj">
    <Project>{48354450-2462-449D-8B32-EFECA39F6CD7}</Project>
    <Name>ProjectName</Name>
</ProjectReference>

The project

Edit
Report

1 Answer

0

visual studio 2010 and 2008 project files (.csproj) are compatible side by side if you have both editors installed, meaning you can upgrade it, work on it in 2010, and have someone else work on it in 2008 without any issues. the only caveat is that you have to leave the target framework as .net 2.0 or 3.5 and that those who work in 2008 have to also have 2010 installed.

the only problem comes if they try to then open the project file in 2008 and they don't have 2010 installed (because I think 2010 adds some new build target that a standard 2008 won't know about). I didn't think this was a problem but I just ran into it this past week (on a web project), so it does exist in some form for some projects.

if you do go the rename route, the best way to go about that is to open the sln file in notepad, and rename the csproj references to the new names by hand (adding any new renamed folder paths), then renaming any folders outside visual studio, then renaming the file name in windows explorer, then rename the csproj in windows explorer, then open the solution in visual studio. your scm bindings may be hosed at that point though...

answered 2011-02-23T08:38:11.780

Your Answer