C# Class VSEmbed.VsLoader

Sets up assembly redirection to load Visual Studio assemblies.
This class must be initialized before anything else is JITted.
显示文件 Open project: SLaks/VSEmbed Class Usage Examples

Public Methods

Method Description
FindAllVersions ( ) : IEnumerable

Finds all installed Visual Studio versions.

Load ( System.Version vsVersion ) : void

Initializes the assembly loader with the specified version of Visual Studio.

LoadLatest ( ) : void

Initializes the assembly loader with the latest installed version of Visual Studio.

Private Methods

Method Description
CurrentDomain_AssemblyResolve_Roslyn ( object sender, ResolveEventArgs args ) : Assembly
CurrentDomain_AssemblyResolve_VS ( object sender, ResolveEventArgs args ) : Assembly
GetInstallationDirectory ( System.Version version ) : string

Gets the installation directory for the specified version.

GetSkuVersions ( string sku ) : IEnumerable
LoadResourceDll ( AssemblyName name, string baseDirectory, CultureInfo culture ) : Assembly
TryLoadInteropAssembly ( string installDirectory ) : bool

The interop assembly isn't included in the GAC and it doesn't offer any MEF components (it's just a simple COM interop library). Hence it needs to be loaded a bit specially. Just find the assembly on disk and hook into the resolve event. Copied from @JaredPar's EditorUtils.

Method Details

FindAllVersions() public static method

Finds all installed Visual Studio versions.
public static FindAllVersions ( ) : IEnumerable
return IEnumerable

Load() public static method

Initializes the assembly loader with the specified version of Visual Studio.
public static Load ( System.Version vsVersion ) : void
vsVersion System.Version
return void

LoadLatest() public static method

Initializes the assembly loader with the latest installed version of Visual Studio.
public static LoadLatest ( ) : void
return void