1

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?

Community
  • 1
  • 1
ljs
  • 37,275
  • 36
  • 106
  • 124

2 Answers2

3

native export from mscoree.dll - GetCORSystemDirectory()

1

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
  • 11,018
  • 13
  • 64
  • 112
  • Unfortunately, unlike Sam Saffron's answer this this does not have version folder. – repka Oct 14 '11 at 22:31
  • But there can be multiple version folders. A simple listing of subdirectories should give you a list of every available version of the framework. All from within the CLR. – glenatron Oct 15 '11 at 23:08