Just completed a complex and frustrating project. Phew. I faced lots of problems and tried lots of solutions. It gave me much more experience then expected. Some of the up-coming posts would be regarding those issues. And here is one of them.
I am always using the latest technologies whenever possible. So, as the Visual Studio 2010 (VS10) and .NET Framework 4 are the latest, I converted a project of Visual Studio 2005 (VS05) & .NET Framework 2 to .NET Framework 4, when the project was needed many big modifications. But then problems of database permissions occurred after installing its setup on Windows 7. After trying a lot to solve the problem, I gave up and had to degrade the project framework to its original development target, .NET Framework 2. Here is the step-by-step method to convert a project of Visual Studio 2010 to 2005 (or convert a project from .NET Framework 4 to 2). (And these steps should also work for converting a project of Visual Studio 2008 to 2005 (or convert a project from .NET Framework 3/3.5 to 2).
- Open VS10 project.
- Open project’s properties window.
- Click on compile tab.
- Scroll down the right side pane to see the “Advanced Compile Options…” button.
- Click on the button, a dialog box named “Advanced Compiler Settings” will appear.
- Open the list box of “Target Framework (all configurations):”. Now the view should be similar as following:
- Select the first option, “.NET Framework 2.0″, from the list and click on “OK” button.
- A message box as following will appear:
- Click “Yes” button. VS10 will then reload/reopen the project. Correct errors (if any) of syntax that occur because of changing the .NET Framework version.
If you are happy with working in VS10 on the converted project, it’s done. But this may not be the case always. You might want to open and work on the project in VS05 how I needed to because I wanted to solve the problem of database permission in setup project. Opening the solution in VS05 will not work, see the following error.
If we try to open that converted project/solution in VS05, a message box similar as following will popup:
So, there are some more steps required.
- Open VS05 and create a blank project. (If there is any windows form in the newly created project, you can remove it and click on “Save All” from standard toolbar or from “File” menu.)
- Right click on the project in Solution Explorer, hover on “Add” option in the menu and select “Existing Item…” from its submenu.
- Select the VS10 project’s .vb (.vb and .Designer.vb) and .resx (if exist) files, and any other files and folders that you want in the new project, and click on “Add” button. (If you are prompted to replace files, click “Yes”.)
- Add references if there were any in the old project and solve any other errors if exist; and it’s done.
Now all should work fine. However in rare cases, a problem of improper nesting of form’s class file (.vb), designer file (.Designer.vb) and Resource file (.resx), could occur when adding existing files from the old project. I will post its solution in the next article.