Friday, May 25, 2007

SharpDevelop 2.1 broke building in Visual Studio 2005 SP1

When I was researching Mono, I installed SharpDevelop to play around with. One of the first things I did was open an existing Visual Studio 2005 solution to see how the SharpDevelop IDE compared to VS. After I opened it, I let the IDE sit their since I had to go do other stuff, and when I came back to it, SharpDevelop had crashed with an unhandled exception. Crap, if the IDE can't even sit still without crashing, how could I even think about using this as my main IDE?!? There were some posts in the SharpDevelop Bug Reporting forum and I added one to the list (still waiting on a response, over a week later). So I stopped looking at it. Yesterday my dalliance with another IDE caused Visual Studio 2005 to go all Glenn Close fatal attraction and I missed a deadline because of it. This is what happened.

I hate you Publish...
The first thing I noticed that something was wrong was when I went to publish my site. I have written before about problems with Publish. Visual Studio was immediately acting weird. You care supposed to see this:

Instead in the status bar, I see this build succeeded. What?!?! At first I am ready to chalk this up to Publish not working, and I go to Scott Gu's blog to get that Publish hotfix. I know I am not seeing the error message described, but hey maybe the installer will fix it anyway. But something is wrong with the link to the hotfix, I see a page not found error. I eventually find DevDiv Hotfix Public Availability Pilot Program. In the table on the site, I find the hotfix, 3rd from the bottom:

I click the download link, only again to see this:

Argh! Again the Output window didn't automatically appear, so I open it and pin it to see if their is any more info and it says this:

Odd, what was skipped and why? Just a little higher up in the Output I see this:

It doesn't make any sense, even with a full rebuild, a clean and rebuild, and me dumping all intermediate products manually and cleaning out anything that looks like a VS cache. I am ashamed to admit, I even rebooted Windows, which I usually make fun of anyone for. It means they are out of ideas, and that was true of me, I was out of gas and starting to freak because I was supposed to have the bits deployed hours ago. So I bagged it, pushed the deadline to get the code tested a day, and came back fresh this morning and finally cracked it.

Do you want an extra project with that solution?
A thread in the back of my mind said "Didn't you open the solution file with SharpDevelop last week? Seems strange, but do you think it edited the solution file?" Hmm, could be, I wouldn't think there was any need to, but could be. So I opened up the directory and I see that TortoiseSVN says the solution file has been edited (icon on the left). Ut oh! I immediately do a diff, and their are two groups of changes, this:

And this:

I surely didn't add any more projects to the solution.

TortoiseSVN sure tells me I haven't, and the GUID in the highlighted block doesn't match anything in the solution file. So I revert the solution file to what is in the repository, and Visual Studio has no problem building or publishing! I haven't proved yet that SharpDevelop did this, it could be a Visual Studio bug. That is of course until I open the solution file in SharpDevelop again. I diff a copy of a SharpDevelop butchered modified solution file with the newly SharpDevelop mangled modified file, TortoiseSVN says they are identical, right down to the dodgy GUIDs used. If I isolate the changes, the problem is not the # SharpDevelop 2.1.0.2429 definition at the top of the solution file, it is the extra configuration junk.

A Cautionary Tale
You could say Visual Studio is a jealous lover. She found out I had an extra-IDE affair and made me pay the price with a blown deadline and hours of frustration. The fault was all mine though. My project contracted an STD (solution transmitted disease) by fornicating with SharpDevelop. It was only because I used protection, a good source control system, that this disease wasn't fatal. The solution recovered and has been deployed. If you are thinking of Giving up on Microsoft, or at least fooling around, be prepared for the consequences.