How to detect .Net framework installed or not.

This is another frequently asked question. If you search google how to detect .Net Framework, this(http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;315291) page ranks very high. Ignore all the details in the KB articles. It basically asks you to check this reg key. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v1.0]. If REG_SZ value 3705 exists, then .Net framework v1 is installed. The same can be applied to…

13

Very long assembly name

Speaking of file name inspired me to write another post about assembly name. Windows supports long file path since Win95 time. It has a MAX_PATH limit, which is defined as 260. Prior to .Net era, you seldom see long file name. If you poke around your system32 directory, you probably won’t notice any thing longer…

9

Where is .Net framework installed?

This is another often-asked question. As of today, there is no managed answer. mscoree!GetCORSystemDirectory returns the directory of where .Net framework is installed. It is documented here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/grfungetcorsystemdirectory.asp). Note the document is not complete. Here is what it says: <quote>Returns the installation directory of the common language runtime that is loaded into the process. The…

2

How to get thread id for a managed thread?

This question comes up from time to time. The answer is, there is no explicit numeric thread id for managed thread today in .Net framework. Now if you do need a numeric thread id for whatever reason, you can use System.Threading.Thread.GetHashCode(). This is documented here.   [update: In .Net framework 2.0, you can use System.Threading.Thread.ManagedThreadId…

10

How to create circularly referenced assemblies

In .Net framework System.dll and System.Xml.dll reference each other. How is it possible? Circularly referenced assemblies are chicken-and-egg problem. The trick is how to break the dependency chain. Here is one way I find working. Step 1. Create assembly A, includes A only types. A references nothing. (Except framework assemblies).Step 2. Create assembly B, uses…

7

Microsoft.Net Framework 1.1 setup has ended prematurely

This trick may have shown up somewhere else. But I still see people asking the same question. So I’ll post it in my blog. Many people experience failure when installing .Net Framework 1.1 Redist. Usually you see a MSI dialog says “Internal Error 2908.”. Later you will see another dialog says “Error 1935. An error…

13