views:

579

answers:

4

We have a solution that has a website and a class library. We also have developers working in VS 2005 and VS 2008. The issue is when a user adds a file/removes a file from the class library it doesn't get added to the project file for the user(s) using the other version of VS. Also I had to setup our automated build to use one project file. Is there a way to work around this or do we need to upgrade everyone to 2008?

A: 

Maybe you should downgrade to VS 2005 - since I'm working now on a project using VS08 and every now and then the paths of the referenced dlls get mixed up and the dlls are lost - or we have the same problem you just described that files that were added from one user are not in the project file for the next one after an update.

Gambrinus
This happens a lot when working with Web Site Projects. Your best bet is to convert it over to a Web Application Project. WSP's automatically scan for assemblies and and files that happen to be in the project path then automatically add them.
Chris Lively
WAP's only scan when it can't locate the assembly in the expected location. Which is still bad for a lot of reasons.
Chris Lively
thanks a lot for the information - I'll keep that in mind
Gambrinus
+5  A: 

You will need to keep each solution file on the same visual studio version. It's ok to split up your product into several solutions though. In this case you may have 1 .sln file that holds your 2005 projects and 1 .sln that holds your 2008 projects.

As you mentioned there is no automatic way to keep a 2005 and a 2008 project in sync, because when you add a file to one of the projects, the other one won't have that new file. Likewise when you remove files.

Brian R. Bondy
Yep. As long as they're added to source control, you can still get them from the other version of VS; you just have to "add existing item".
Will
A 2008 project will open fine in 2005. It's only the 2008 solution file that won't open in 2005. Keep a 2005 and 2008 solution files, have both reference the same 2008 project files. See my answer.
chyne
+6  A: 

Working with two different version of Visual Studio in a team of more than one project member absolutely makes no sense. I recommend to downgrade to Visual Studio 2005 or upgrade to Visual Studio 2008. You can install several versions of Visual Studio on the same machine with no side effects.

Alexander
-1 In a world where money grows on trees, there are no licensing issues and developers are allowed to install whatever they want on there workstations it might "absolutely makes no sense".In the real world, however...
chyne
Sorry but the time you spent in keeping your projects in sync when using different IDE's will cause more costs than a license of Visual Studio. A craftsman should never try to save money by his tools.
Alexander
I have a legitimate situation where we would need this. Most of the team cannot move to 2008 yet, but the tools team does to use wpf. the tools use some shared libraries, and so we need to keep the 2008 and 2005 projects in sync.
Anthony Brien
A: 

I'm not sure about "Web Site" (rather than "Web Application") projects, but generally you don't need different project files for 2005 and 2008. You only need separate solution files.

Just open your 2005 project in 2008 and allow it to upgrade your solution/projects. You may get a dialog asking you to update CLR versions, just say no.

Once you've got a working 2008 solution, copy the *.sln file to another name (I call my copy *.2005.sln), open the copied *.sln file in notepad, or your favourite text editor. Find "Format Version 10.0" on the 2nd line, and change to "Format Version 9.0". Save the file.

That's it, your upgraded solution file works in VS 2008, and the one you copied and changed works in VS 2005.

There's one extra step if you've got Web Application Projects. In the Web Application's vbproj or csproj file, find the line:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplications.targets" Condition="" />

and replace that one line with these two:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplications.targets" Condition="'$(Solutions.VSVersion)' == '8.0'" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplications.targets" Condition="'$(Solutions.VSVersion)' == '9.0'" />

Those two lines will conditionally select the correct MSBuild path depending on the version of VS used.

chyne
Although accurate on how to convert a VS2008 solution to a VS2005 solution, it doesn't address the question about how to keep those two files in sync.
Chris Lively
The OP asked about keeping PROJECT files in sync. I'm saying don't sync project files, just re-use THE SAME project file. Vary only the solution file between versions. How often does a solution file change?
chyne