Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Convert vb.net 2010 project back to 2008


Reply
 
Thread Tools Display Modes
  #1  
Old 07-01-2010, 09:50 AM
DarkPhane's Avatar
DarkPhane DarkPhane is offline
Centurion
 
Join Date: Aug 2009
Posts: 131
Default Convert vb.net 2010 project back to 2008


At home I have 2010 vb.net express edition, this is what I code all of my projects in. However, today I discovered that my school only has 2008 and will not be upgrading anytime soon... So is there a way I can get my projects to be converted to a form that 2008 can run or save them in 2010 as a 2008 project? Currently all I get are errors which frankly I don't really want to have to spend the time dealing with, for example the one attached...


Any suggestions would be welcomed,

Thanks,

Phane.
Attached Images
File Type: jpg ConversionError.jpg (69.0 KB, 10 views)
Reply With Quote
  #2  
Old 07-04-2010, 02:31 AM
stumper66 stumper66 is offline
Regular
 
Join Date: Jul 2005
Location: Seattle, Washington, USA
Posts: 86
Default

I've done this before when VS 2010 was in beta.
Hopefully you have a simple project.

First, I create a new project in VS 2008 and match initial settings.
Then create new form, and set the designer properties the same.
Then open the corresponding old forms, select all and paste it the VS 2008 form. Do the same for the code behind.
You'll need to re-associate all the event handlers.
Do the same for each form.

Shouldn't take too long if you only have a few forms.
Reply With Quote
  #3  
Old 07-04-2010, 10:53 AM
Qua's Avatar
Qua Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

There are several guides online to help you revert the IDE version related to your project such as this one. It won't fix any issues using .NET 4.0 features tho.

If it is possible, then installing VS to an USB-pen might be a good option. Then you could bring it to school, and still use visual studio 2010.
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #4  
Old 07-04-2010, 12:04 PM
AtmaWeapon's Avatar
AtmaWeapon AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,505
Default

Quote:
Originally Posted by Qua View Post
If it is possible, then installing VS to an USB-pen might be a good option. Then you could bring it to school, and still use visual studio 2010.
I'm really suspicious that this won't work at all. VS depends on many libraries and registry keys being present on the system; I think installing it on a portable drive and trying to use it on an unprepared computer would likely be a recipe for pain. If you've had experience with this and had no problems though I'm interested.

Here's what I do when I need to convert to/from particular VS versions:
  • Make a project in the lower version (in this case VS 2008).
  • Copy that project for later use (in particular, you're interested in any *.vbproj and *.sln files.
  • Upgrade the original project in the later version of VS.
  • Compare the upgraded *.vbproj to the original one. Now you know what changes are required to upgrade/revert.
  • Compare the upgraded *.sln to the original one. Now you know what changes are required to upgrade/revert.
I've never seen the *.sln file change much between versions; I think the first few lines have two instances where the new VS version number is referenced; if it says "10.0" changing it to "9.0" converts the solution.

Project files are a bit more finicky, particularly from VS 2005 to VS 2008. From memory, the changes from 2008 to 2010 are also near the top of the file, and involve the <TargetFrameworkVersion> tag becoming a <TargetFrameworkMoniker> tag.

If you plan on frequently using both versions of VS (a bad idea, but maybe unavoidable), keep a copy of each solution and project around. I have to keep VS 2005, VS 2008, and VS 2010 versions of some of my code around, and to facilitate this I adopted a naming convention:
Code:
SolutionFile.2005.sln
SolutionFile.2008.sln
ProjectFile.2005.vbproj
ProjectFile.2008.vbproj
Note that since your school works with VS 2008, you should take care to change the target framework in your VS 2010 project. Right-click the project in Solution Explorer and select "Properties...". In the property pages, select the "Compile" tab. Click the "Advanced compiler options..." button, and in the dialog that appears make sure the "Target Framework" combo box is set to ".NET Framework 3.5". 3.5 is the highest version supported by VS 2008, and if you write your code against .NET 4 you might accidentally use parts of the .NET framework that don't exist as far as VS 2008 is concerned.

You should also be aware that there were some small language changes in VB .NET between 2008 and 2010; these features will produce errors in VS 2008. For example, in VS 2010 you don't need explicit line continuations:
2010
Code:
Public Sub SubWithLongArguments(
    ByVal reallyLongArgument As SomeLongType,
    ByVal nextArgument As SomeLongType)
End Sub
2008
Code:
Public Sub SubWithLongArguments( _
    ByVal reallyLongArgument As SomeLongType, _
    ByVal nextArgument As SomeLongType)
End Sub
Another useful example; VB 2010 supports automatic properties:
2010
Code:
Class Foo
    Public Property Bar As Integer
End Class
2008
Code:
Class Foo
    Private _bar As Integer
    
    Public Property Bar As Integer
        Get
            Return _bar
        End Get
        Set(ByVal value As Integer)
            _bar = value
        End Set
    End Sub
End Class
Keep an eye out for these kinds of incompatibilities. If you have troubles, we can help so long as you post enough details about the code and the errors it causes to give us an idea of what's going on. You should also include "it runs fine in VS 2010 but not in VS 2008" in those posts, as that is a very important detail.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #5  
Old 07-05-2010, 03:55 AM
DarkPhane's Avatar
DarkPhane DarkPhane is offline
Centurion
 
Join Date: Aug 2009
Posts: 131
Default Thanks!

Thank you for all the links and suggestions - I've got the project running in 2008 with no problems now...

Thanks especially AW for the detailed suggestions - I'm certainly gonna employ the naming conventions for the .sln and .vbproj files. Also thanks for the mention of the changes in code between the two pieces of software; I completely forgot that had happened!


Cheers again for all the suggestions,

Phane.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->