search
Twitter Rss Feeds
MicrosoftArticlesForumsGroups
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml/Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

Web ProgrammingArticlesForumsGroups
JavaScript
ASP
ASP.NET
Web Services

Non-MicrosoftArticlesForumsGroups
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

DatabasesArticlesForumsGroups
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsGroups
Microsoft Excel
Microsoft Word
Microsoft Powerpoint
Publisher
Money

Operating SystemsArticlesForumsGroups
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsGroups
Share Point
BizTalk
Site Server
Exhange Server
IIS
Transaction Server

Graphic DesignArticlesForumsGroups
Macromedia Flash
Adobe PhotoShop
Microsoft Expression

OtherArticlesForumsGroups
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Reviews
Search Engines
Resumes

 
Converting Solutions from Visual Studio.NET 2003 to 2002
By Peter A. Bromberg, Ph.D.
Printer - Friendly Version
Peter Bromberg

Because I have switched over to Visual Studio.NET 2003 exclusively, (I've wiped 2002 off all my boxes already!) I realized there would be times that I needed to convert Solutions and projects back and forth between versions. So, not being one to reinvent the wheel, I searched around and found this article and code by "Dacris" . In that article, he explains the necessary steps to convert .soln, csproj, .vbproj, .resx etc. files from one version to the other.

I played around with it and although his code is sound, it's a little outdated (the last build on RTM is now 3077). In addition, I didn't particularly like the un-intuitive way you had to go and choose and load each of the files that needed to be changed. Also, it didn't have any exception handling for some of the more common file problems, such as what if your project contains read-only files? You certainly want to know about it, but you sure don't want the program to blow up on you if it does.

I reasoned, VS.NET solution files are almost always in a folder and its subfolders. So why not just have a kind of "Folder Dialog" that lets you choose the folder of the Solution you want to convert, and it would automatically iterate all the subfolders and files and load them into the listbox for you.

Then when you hit the convert button, it would take care of everything. So i added to and improved his example and came up with my own "converter utility". The result is shown below:


You can download the full VS.NET 2003 solution which includes a pre-built release executable, at the bottom of this article.

As always, I'm going to share some code that will illustrate how this all can be done. First, we have a folderSelect class that uses the Treeview Control to build a list of folders on available drives. You press LOAD and navigate to the folder of your project and select it. It then uses the TraverseFolder method to recursvely add all of the correct file items to the listbox:

private void TraverseFolder(DirectoryInfo dir)
        {
            FileInfo[] filesInDir = dir.GetFiles();
            foreach(FileInfo file in filesInDir)
            {
                                 
              if(file.Extension ==".sln" || file.Extension ==".vcproj" 
|| file.Extension ==".csproj" ||file.Extension ==".vbproj"
|| file.Extension ==".user" || file.Extension ==".resx") listBox1.Items.Add(file.FullName); } DirectoryInfo[] directories = dir.GetDirectories(); foreach(DirectoryInfo newDir in directories) { TraverseFolder(newDir); // recursive call } }

Once the items are added, we have the two original methods that will load each of the files in the listbox, convert the correct items in the selected files to their new values , and save off each file. I added auido feedback, exception handling, and informational messages are written to the Label control at the bottom of the main form. And that's it! Easily convert VS.NET 2002 solutions and project to 2003, or from 2003 back to 2002!

And before I close, let me just share a little popular financial wisdom that totally knocks me out, now that we seem to have finished the main part of our business in Iraq and I've filed my tax return. When is a tax cut not a tax cut? Last time I looked, we still have a progressive tax system that unfairly penalizes entrepreneurship and wealth. If you make $10,000 a year and I make $100,000 a year and we both pay 10% income tax, aren't I contributing 10 times more money to the tax system than you are? Fair enough, right? But the fact is, because my progressive tax rate is actually so much higher than yours, I am actually contributing far more than 10 times the amount. Now some liberal mathmaticians, with their incredible faulty math, think that because an across - the board tax cut wouldn't put as much money in the hands of the $10,000 people, that it unfairly "benefits the rich"! As usual, they are promoting this "up the gazoo".  And you know what? Most of the polls show that the majority of the American public actually believes this rubbish!

N.B. As I update this on 3/12/04 to include a link to the MSI for the 2002 version (by popular request) this rings true- our friend John Kerry et. al. think the rich aren't paying their "fair share". Faulty math...

MSI installer for the 2002 version: http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=515

 

Download the code that accompanies this article


Peter Bromberg is a C# MVP, MCP, and .NET consultant who has worked in the banking and financial industry for 20 years. He has architected and developed web - based corporate distributed application solutions since 1995, and focuses exclusively on the .NET Platform. Pete's samples at GotDotNet.com have been downloaded over 41,000 times. You can read Peter's UnBlog Here.  --><--NOTE: Post QUESTIONS on FORUMS!

Do you have a question or comment about this article? Have a programming problem you need to solve? Post it at eggheadcafe.com forums and receive immediate email notification of responses.



Pete's Blog   |    Pete's Resume   |    Robbe's Blog   |    Robbe's Resume   |    Archive #2   |    Archive #3   |    Dotnetslackers   |    XmlPitStop   |    Advertise   |   Contact Us   |   Privacy   |   Copyright (c) 2000 - 2009 eggheadcafe.com  All rights reserved.