Click or drag to resize

FrameworkContext Class

Represents a group of loaded assemblies for a particular target framework version, loaded into a particular AppDomain.
Inheritance Hierarchy
SystemObject
  Nova.CodeDOMFrameworkContext

Namespace:  Nova.CodeDOM
Assembly:  Nova.CodeDOM (in Nova.CodeDOM.dll) Version: 7.44.8391.13415
Syntax
C#
public class FrameworkContext

The FrameworkContext type exposes the following members.

Constructors
  NameDescription
Public methodFrameworkContext
Create a FrameworkContext.
Top
Properties
  NameDescription
Public propertyApplicationContext
The ApplicationContext object associated with this FrameworkContext instance.
Public propertyReferenceAssemblies
A dictionary of the reference assemblies for the target framework by name.
Public propertyReferenceAssembliesPath
The path of the reference assemblies for the target framework.
Public propertyTargetFramework
The target framework for this FrameworkContext instance.
Public propertyTargetFrameworkProfile
The target framework profile for this FrameworkContext instance.
Public propertyTargetFrameworkVersion
The target framework version for this FrameworkContext instance.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Protected methodFindVsAssembly
Public methodStatic memberGet
Get the FrameworkContext object for the specified target framework version.
Public methodGetDescription
Get the full description of this target framework.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodStatic memberGetRuntimeLocation
Get the .NET runtime location for the requested version.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsFrameworkAssembly
Determine if the specified assembly exists in the targeted framework.
Public methodLoadAssembly
Load an assembly into the current AppDomain, treating any matching short name as a framework assembly for the targeted framework (non-matching names or display names are loaded normally).
Public methodStatic memberLoadNuGetFiles
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUnload
Unload the FrameworkContext (clears the map of loaded framework assemblies).
Public methodStatic memberUnloadAll
Unload all FrameworkContext instances.
Top
Fields
  NameDescription
Protected field_applicationContext
The ApplicationContext object associated with this FrameworkContext instance.
Protected field_frameworkAssembliesPath
The path of the assemblies for the target framework.
Protected field_frameworkAssemblyNames
A dictionary of names of the assemblies for the target framework, mapped to the LoadedAssembly if loaded.
Protected field_frameworkAssemblyRelPaths
A dictionary of names of the assemblies for the target framework, mapped to their longer name including folders (for NuGet used by v5.0+).
Protected field_isAndroid
True if this is an android framework context.
Protected field_nonProfileFramework
The associated non-profile framework if this one has a profile (otherwise null).
Protected field_previousFramework
The previous version framework to this one (null if none).
Protected field_targetFramework
The target framework for this FrameworkContext instance.
Protected field_targetFrameworkProfile
The target framework profile for this FrameworkContext instance.
Protected field_targetFrameworkVersion
The target framework version for this FrameworkContext instance.
Public fieldStatic memberDNXCoreFramework
Public fieldStatic memberDotNetCoreApp10
Public fieldStatic memberDotNetCoreApp20
Public fieldStatic memberDotNetCoreFramework
Public fieldStatic memberDotNetFramework
Public fieldStatic memberDotNetStandard
Public fieldStatic memberPortableLibraryFramework
Public fieldStatic memberSilverlightFramework
Public fieldStatic memberWindowsPhoneFramework
Top
Remarks
Assemblies for different target frameworks (.NETFramework, Silverlight) must be managed with separate FrameworkContexts so that when a framework assembly is loaded by simple name it will load the correct one and not mix assemblies from different target frameworks in the same project. Perhaps a single FrameworkContext could be shared for different target framework versions when using reflection-only loads or Mono Cecil loads, since different versions of the same assembly can be loaded simultaneously, but separate FrameworkContexts are used currently. Even if different FrameworkContexts exist for different target framework versions, they can generally share a single (current) AppDomain when using reflection-only or Mono Cecil loads, or if all projects target the same framework version and don't load different versions of the same assembly. The code also supports using an existing version of an assembly that differs from the requested one, which will often work without errors. Another complication is that the .NET 3.0 and 3.5 frameworks are "partial" releases that also use assemblies from previous releases, so their FrameworkContext objects must work together with those for the earlier versions (they can't be self-contained, because in some situations that would result in an attempt to load the same version of the same assembly twice into the same AppDomain). The .NET 4.0 release is complete, and doesn't have this problem. Actually, there is another exception - if a framework assembly doesn't exist in the current framework context, then in that case, it's OK to look in an earlier version. For example, some assemblies are versioned in the name, such as Microsoft.Build.Utilities.v3.5, so there's no name conflict between releases. For .NET 5.0, the assemblies are specified using NuGet format (a 'project.lock.json' file), typically located in the reference assemblies path ('C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\') under '.NETCore\v5.0'.
See Also