How to check compatibility between my program and .NET Framework versions?

I am writing a program designed to run on .net framework 2.0.

I chose 2.0 in my VS project.

It works fine on my machine (I have 2.0 SP2), so there is no compilation error. but when I tried to run it on another machine (only with 2.0, no sp), it could not work. I know that I used some method supported by 2.0, but only with 2.0 SP2.

The .net framework 2.0 SP2 does not seem to be listed in the VS IDE, so VS cannot warn me when I compiled it on my machine.

How can I easily check the compatibility of my codes with .net framework 2.0 SP2? or do i just need to look at msdn to check every method i used ???

thanks

+6
source share
3 answers
+4
source share

If you know exactly which specific libraries (dlls) distinguish 2.0 SP2 from just 2.0, you can try to programmatically find and download them. If it fails, then SP2 is missing.

If there are no β€œnew” DLLs, you can use reflection to check if the class has a specific method. If so, you have SP2.

This is a runtime solution, so you can display a friendly message to the user.

0
source share

You can determine where there is an error in your code when there is no sp.

Then you just create a dummy fragment that uses this structure and catch the exception.

If the exception is not caught, you are fine. If an exception is thrown, you may be missing sp2.

0
source share

All Articles