onsdag, november 07, 2007

Switch between VS 2005 and VS 2008

I have made two small scripts that make it possible to develop using Visual Studio 2008 Beta 2 in a group using Visual Studio 2005.
And I'm sure these scrips could be very usefull if you want to make some other batch search replace on some files.

Surely my scrips don't cover all solution files but I'm sure you could modify them to cover your solutions.
As a base I use RxFind a regular expression search and replace, command line tool I found at CodePlex. To make it more usefull for this case I made a couple of small modifications.
I added the possiblity to take the search and replace expressions from an input file. This makes it easier to handle line breaks and "-characters in the expressions. When you avoid a few of the escape characters, it is much easier to read.

Use it like this.
  • Modify the file name and path in the first rows of the batch files.
  • Open your Visual Studio 2005 solution that should be under version control., in Visual Studio 2008 (Beta 2)
  • Let the conversion wizard do it's job.
  • Let your version control system show which files where modified
  • Try to run: "first time to2005.bat"
  • In the ideal world the solution should now not contain any modifications and it should be possible to open it in VS 2005 like before.
  • Run to2008.bat, it should now be possible to open the solution in VS 2008.
  • Run to2005.bat, if there are some modifications you want to commit, do so.
Runing this back and forth, I found a few small changes that I wanted to do in the project files. Changes that should be there in both the 2005 and the 2008 version of the files.

* If my script and your modifications work you should be able to work like this, using subversion/cvs terminology:

10 Checkout
15 run to2008.bat
20 Use the project in VS 2008
30 Make updates and so on
40 Run to2005.bat build and run the tests (I do this from the command line)
50 commit
60 Goto 15 ;o)

BTW The script are made for C# but could probably be modified for VB very easily, if there are some real VB-hacker out there...
If you have spaces in your solution file name or in the path where you put your tool, you would have to add a few "" in the batch file, but since i didn't need it. I leave it as an exercise for the reader.
One of the benefits I get out of this is that I can avoid conflicts between my favorite VS add in for C++(Visual Assist) which I use in VS 2005 and my favorite/current VS add in for C# (ReSharper) that I use in VS 2008.

Download scripts

Download updated source for RxFind

2 kommentarer:

Unknown sa...

Ping! ;~)

Thank you Björn!

/Magnus

Johan Wikström sa...

Thanks, been looking for something like this! Works like a charm!

ps. Thanks for a good Silverlight seminar yesterday.