Monday, March 17, 2008

Rolling back Visual Studio 2008 projects to Visual Studio 2005

You might ask, why would I want to roll back my VS 2008 projects to VS 2005? Well if like me you were hasty in upgrading your solution and didn't relise or forgot that CF 1.0 projects are not supported under VS 2008 and upgrading will upgrade CF 1.0 to CF 2.0, then you have every reason to do so.

We still have CF 1.0 projects or project which is used for an autorun app which gets shipped on a memory card on PPC 2003 SE and later because CF 1.0 is installed in ROM from PPC 2003 SE. Doing this enables our application to self-install on cold-boots or power failures.

Luckily it isn't too difficult rolling back your projects (although you should use some kind of source control system to roll back to). If you don't a source control system or just curious how to do it, it is dead easy.

Simply open up the project and change the ToolsVersion attribute to 2.0. Change the TargetFrameworkVersion element to 2.0. You can get rid of the Import element which specifies CF 3.5. IE:
<import condition="'$(TargetFrameworkVersion)' == 'v3.5'"
project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets"></import>

Ensure a CF 1.0 or CF 2.0 exists. If you have a desktop project you might have a
<requiredtargetframework>3.5</requiredtargetframework>
for some of the framework assemblies, if rolling back, these can be deleted.

Rolling back the solution couldn't be easier. At the header of your solution file (.sln) you'll have the following:

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008

Change the above to:

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005

That's it!

6 comments:

Thiago said...

I Whant to know how do I Change .NET CF version in Visual Sudio 2005.
Could you tell me something about this?

techSage said...

For a CF project that I was downgrading from 3.5 to 2.0, I got the error message:
"The imported project "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.CompactFramework.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk."
after following your instructions. I had to change the ToolsVersion back to 3.5 to fix the problem. It seems that you are still using 3.5 Tools to make a 2.0 project, so this does not need to be changed from 3.5 - at least running Visual Studio 2008.

Anonymous said...

VERY HELPFULL, WITH ME WORKS FINE!!

rogeriosca said...

Ok, works great! thanks!

rogeriosca said...

works great! thanks!!

dr. pferiffer said...

just saved my ass!!! kudos..