tags:

views:

105

answers:

2

The MSDN article on the C# command-line compiler /lib switch specifies the following:-

The compiler searches for assembly references that are not fully qualified in the following order:

  • Current working directory. This is the directory from which the compiler is invoked.

  • The common language runtime system directory.

  • Directories specified by /lib.

  • Directories specified by the LIB environment variable.

How do you programmatically determine where the CLR runtime system directory is located on the system?

+1  A: 

You might check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\InstallRoot to find the location of the .Net runtime.

You can access the registry using the Microsoft.Win32.Registry classes.

glenatron
+1  A: 

native export from mscoree.dll - GetCORSystemDirectory()

+1 nice one, do you need to have a switch that tries for mscorwks as well ?
Sam Saffron