views:

386

answers:

4

I have Visual C# 2008 on my home computer but 2005 on my computer at school. Is there a patch or something I can download to be able to run 2008 files on 2005?

+1  A: 

Most of your code should work just fine. The stuff that will not work in Visual Studio 2005 is anything new in C# 3 as those language features require the C# 3 compiler.

Here is a non-exhaustive list of things that C# 3 has that will not build with the C# 2 compiler:

lambda expressions
auto-implemented properties
object initializers
collection initializers
extension methods
partial methods
implicitly typed local variables
anonymous types

(Please feel free to expand this list...)

Perhaps the best thing to do is to download Visual C# 2008 Express Edition at school (if you can) so that you can freely share whole projects.

Andrew Hare
The solution files themselves are an issue: vs2005 won't use vs2008 solutions without some serious tinkering.
Joel Coehoorn
+1  A: 

The quickest thing I know is to just make a new, empty VS 2005 project and then right-click on it, select "Add Existing Items...", and then select all your code from your VS 2008 project. Like Andrew said, as long as your not using something 3.0 or higher, it should compile fine.

LWoodyiii
A: 

If you are a student, you could go to Microsoft Dreamspark and get Visual Studio 2005 Professional for free? It will run fine side-by-side with your upgraded version (VS2008). That way, when you edit projects at home, you can continue working on them in school and the project files will still be compatible.

Otherwise, solution files between Visual Studio versions are not downward compatible. Your best option would be to create a new project in VS2005, add the source files then "replace" any code that references .NET 3.0 or .NET 3.5. But if you continue editing in VS2008, you have to repeat the process each time you go back to school. Yuck.

Enjoy,

Robert C. Cartaino

Robert Cartaino
Project files should work just fine.
Mehmet Aras
+1  A: 

You may also look at a downgrader application: http://mises.org/Community/blogs/misestech/archive/2008/02/28/visual-studio-2008-to-2005-downgrade-utility.aspx

Matt Andreko