R – Choosing which Service Pack of the .Net Framework to build against

.net-2.0compiler-constructionmsbuildmsbuild-tasknet

I have read many questions (and answers) around here that had similar sounding terms in them as this question, but all of them ended up being about building against different major versions of .Net. I am in much deeper trouble, unfortunately.

Here is the story. Our customers use version 2.0 of the .Net framework. Just 2.0, no service packs at all. Our developers used to use .Net 2.0 SP1, which worked fine. Now, due to other projects we are working on, the developers (myself included) updated to .Net 2.0 SP2. And this is where the trouble began. Apparently, in its infinite wisdom, MS decided to change/add API to the framework without incrementing the major version (to, say, 2.1). So when you build against 2.0, it builds against 2.0 SP2 (if you have it installed) and there doesn't seem to be a way to configure it. So the developer can now write code thinking he is targeting 2.0, but it won't work on the customer machines!

We have noticed that certain builds (done using msbuild) started failing on our test boxes, but work fine on the developers' machines. Obviously, because the test-box is setup the way client machines are, and their older framework is missing some of the APIs. Now the build farm is going to install the newer version of the CLR (including spervice packs and higher major revisons) to test all our projects, so the builds that use the API that are not in original 2.0 will no longer fail… this is terrible news for compatibility testing.

So my question is this. How to build (using msbuild) against a specific CLR revision (of the same major version). Failing that, how to make sure VS2005 throws an error when a particular project uses features incompatible with particular revsion of the CLR (to throw a wrench into the cogs, no FxCop or similar integration, basic VS2005 features only)?

If the above questions do not have a positive answer, I am all for seeking alternatives.

Thank you.

Best Answer

There should have been no impact of updating to SP2 unless you used the new APIs. Exactly what failures did you see on the build machine?

I agree, BTW, that they should not have added anything without changing the minor rev. It was for Vista, though, and they lost their heads.

I guess.