sharp bites

standing on the shoulders of giants

The price of change

Change is expensive, no question about it. However, consider the alternative—stagnation.
Jim Highsmith

Targetting .NET 2.0 with Nant and Visual Studio 2008

If you try to migrate a solution to VS2008 and you are using nant, you’ll probably find a few problems. This is one of them I am documenting for you.
I wanted to use VS2008 and nant, but still want target the .net 2.0 framework. I read somewhere I needed to install the .net 2.0 sdk, but I was still having issues, where msbuild was complaining it didn’t recognize the format of the solution file.
It turns out you need to change nant.settings.currentframework to “net-3.5”, so that it is the version of msbuild that comes with msbuild who compiles the solution (so I am not sure anymore you need the .net 2.0 sdk). It will still target the .net 2.0 framework for your projects if you set that that way in VS, as msbuild uses that info for the target.

Hope it helps someone out there.

Programming for the Mob sharks? No, thanks.

Ward Cunniham, of Ward’s Wiki fame, was the coiner of the term “technical debt”. He made an interesting clarification in the following video:


According to his intention, the term is usually misused to reflect (and even encourage) the writing of sloppy code with the excuse that it will be refactored later. His original vision was more aligned with the XP style of simple design.

Doing bad code with the excuse of refactoring somewhere in the future is not technical debt we are going to pay, but rather asking money from loan mob sharks at an astronomic interest rate and the expenses of losing a few body parts in the way.

PS: It is funny how the metaphor was coined as an analogy that his boss could understand, but it has grown to be used and abused by everybody in the industry. Maybe that’s also related to the debt culture that has drawn our uneducated society into the current situation.

Quality

Quality means doing it right when no one is looking.
Henry Ford

Assumptions

Assumption is the mother of all screw-ups.
Wethern’s Law of Suspended Judgment

[SPAM-LOW] Isolator for SharePoint

The Typemock guys have released a version of Typemock isolator for SharePoint. This is the announcement (which will hopefully grant me a license to try Typemock):

Typemock are offering their new product for unit testing SharePoint called Isolator For SharePoint, for a special introduction price. it is the only tool that allows you to unit test SharePoint without a SharePoint server. To learn more click here.

The first 50 bloggers
who blog this text in their blog and tell us about it, will get a Full Isolator license, Free. for rules and info click here.

Fix: Can’t install updates on Windows XP after installing SP2

Just in case it happens to me (or you) again.

1. Open command prompt (or use a for a better console).
2. net stop wuauserv
3. regsvr32 %windir%\system32\wups2.dll (regsvr32 %windir%\syswow64\wups2.dll for win64)
4. net start wuauserv
5. exit


http://forums.cnet.com/5208-6142_102-0.html?forumID=5&threadID=276886&messageID=2660716
http://support.microsoft.com/kb/943144

Why SVN sucks

“A common desire is to refactor source code, especially in Java-based software projects. Files and directories are shuffled around and renamed, often causing great disruption to everyone working on the project. Sounds like a perfect case to use a branch, doesn’t it? Just create a branch, shuffle things around, and then merge the branch back to the trunk, right?

Alas, this scenario doesn’t work so well right now and is considered one of Subversion’s current weak spots.”
Subversion book

The fact that subversion lacks a true rename operation (it is done via copy & delete) you can get into a lot of troubles if you rename or move files in subversion if somebody else modifies the same file meanwhile. And by troubles I mean losing data! (If you want more info about it, check this bug entry. You will find the detailed use cases in the attached files there.)

For a fast rename (or move, which is exactly the same operation) & commit, there is a low probability you run into this issue (assuming the other guy also updates frequently), so things aren’t so critical here. But, when working with branches, it’s a whole new story. They will live much longer (from days to weeks or months) so the probability of somebody modifying a file renamed in another branch increases a lot. That effectively means you cannot rename or move files if you use branches. Yeah, you read it right. If you use branches, moving files is not safe. End of story.

So, what svn is forcing us to do is either:
a) Don’t rename files.
b) Don’t use branches.
c) Don’t use subversion.

a) is simply stupid, so let’s forget it. b) might be ok for some people/enviroments. c) is what you really should be doing if b) is not an option (which makes perfect sense).

If you are looking for alternatives, use git or mercurial.

nant vs. msbuild

Yes, this is yet another post on nant vs. msbuild.
I had to choose which one of the two to use at the company I work for. After doing a lot of research, it looks like there aren’t many differences between them. Here are some of the pro/cons I found:

- msbuild comes from Microsoft (yes, that usually matters to some (not all, like me) people)
- msbuild is already installed in every .net developer machine (not a big deal)
- msbuild has probably better integration with VS build process
- msbuild supports parallel builds since .net 3.5 (not that it really matters, since you usually use msbuild from nant to build your projects, anyway).
- msbuild evaluates filesets at startup. This seems to cause some headaches when you want to manipulate files generated during the building process.
- you can redefine targets in msbuild. in nant you can define general targets and just make your build files call those (or create and use hooks, which is a solution I don’t really like).
- nant has more examples and better documentation
- there is much more information about nant than about msbuild on the web, according to google trends and google search results (both in english and spanish)
- nant has some more tasks, but with msbuildtasks/sdc tasks it’s on par with nant and nantcontrib.
- nant helper functions and expressions are better ¿?
- I like nant syntax better.
- nant is more mature, msbuild was born as an alternative (alt.alt.net :D) to nant for companies with ridiculous “no open source here” and Microsoft “I can’t support an open source project I don’t control” way of life.
- most open source projects tend to use nant over msbuild, so there are plenty of build files and task you can make good use of or have as a reference.
- I have already played with nant a little, so I know it’s syntax better.
- I have started to use nant to automatically generate config files from templates for the different enviroments, and didn’t find the way to do so in msbuild.
- nant is open source, so people can contribute to it.
- nant is not tied to microsoft release cycle, msbuild is.


There isn’t any strong reason in itself to pick one, but adding them up, things favoured significantly nant over msbuild, so I ended up choosing the former.

If you want to read more on the subject, here are some of the links I used in my research (in no particular order):
http://ayende.com/Blog/archive/2008/02/25/Zero-Friction-and-why-Defaults-Matters.aspx
http://www.winterdom.com/weblog/2007/09/21/MSBuildVsNAnt.aspx
http://www.paraesthesia.com/archive/2008/01/08/why-nant-is-better-than-msbuild.aspx
http://www.innoq.com/blog/hw/2007/09/24/msbuild_vs_nant.html
http://www.codeproject.com/KB/books/msbuild.aspx
http://brandonbyars.com/blog/articles/2008/01/10/Managing-Config-Files
http://www.paraesthesia.com/archive/2008/01/08/why-nant-is-better-than-msbuild.aspx
http://kentb.blogspot.com/2008/02/fail-early-with-full-builds-from-within.html
http://weblogs.asp.net/rosherove/archive/2008/01/18/trying-out-team-city-looks-promising.aspx
http://codebetter.com/blogs/jeremy.miller/archive/2007/09/20/is-there-a-good-reason-to-switch-to-msbuild.aspx
http://codebetter.com/blogs/jeffrey.palermo/archive/2007/09/25/demo-on-automating-your-build-with-nant-and-ccnet.aspx
http://www.distribucon.com/blog/WhyMSBuildSucks.aspx
http://www.tkachenko.com/blog/archives/000643.html