tags:

views:

107

answers:

4

Does the ASP.NET code developed on VS 2008 can be used on VS 2005 ??

+1  A: 

Sadly, the answer is "it depends" and probably "no". There are some features in VS 2008 that aren't backwards compatible with VS 2005. The easiest way is to take a copy of the code and try it - but the likely outcome is that you've used new features that aren't available - such as...

  • .NET 3.5 stuff!
Sohnee
I'd add to that (separately) "C# 3.0/VB9 stuff" (the language and framework being slightly different beasts), but +1
Marc Gravell
A: 

If its targeted for version 2.0 of the runtime, the source will run (mostly) on v2005 however there may be issues with the proj file.

Excuse me, the solution file

almog.ori
Project files are compatible between 2005 and 2008 however solution files are not.
AnthonyWJones
You can't guarantee that "the source will run on v2005"; you can use most of the C# 3.0 / VB 9 **language** features even when targetting 2.0 - which **won't** work in VS2005
Marc Gravell
Project files are not quite compatible. You'll need to manipulate the ToolsVersion attribute of the Project element.
John Saunders
+2  A: 

Visual Studio 2008 allows you to target either the .NET 2.0, .NET 3.0 or .NET 3.5 .NET Framework. If you have targeted .NET 2.0, then you should be able to use that code either in a .NET 2.0 site, or even in VS2005.

The only difference is that there is a trivial change in the project files (.vbproj or .csproj). You would have to edit the project files to remove the ToolsVersion="3.5" attribute from the <Project/> element.

John Saunders
You can use C# 3.0 / VB9 language features even when targeting 2.0; if you've used any such language features, it won't compile in VS2005.
Marc Gravell
+2  A: 

The big issue with ASP.NET when using both 2008 and 2005 is syntax.

It possible in 2008 to write code using C# 3 syntax such as var or => that work find because they are compilied with C# 3. But 2005 only understands C# 2 and won't understand new C# syntax elements. I would guess the same is true of the later version of VB.

So even if you were careful with your framework references you could still be caught out by using syntax incompatible with older compiler versions.

AnthonyWJones