Interface ICompanionPackageSource
Companion packages that the host adds to the sessions it loads, besides those the session's packages declare (CompanionPackageSource). The editor uses it for the extensions the user installed; the session itself knows nothing of them.
[Experimental("STREXP002")]
public interface ICompanionPackageSource
- Extension Methods
Remarks
Each companion goes through the same steps as a declared one: the toolkit of the host, the session's ICompanionPackageFilter (asked with no declaring package), the dev redirect, the restore, and the session's IAssemblyLoadCheck when its assemblies load. A companion that a package of the session already brings (a project of the solution, or the companion of a package the game references) is not added a second time: the session's own one loads.
Properties
PackageSources
Folders (local NuGet feeds) where the restore of these companions also looks for packages, besides the NuGet sources configured for the session.
IReadOnlyList<string> PackageSources { get; }
Property Value
Methods
GetCompanionPackages(ILogger)
The companions to add. Read once per session, at its first load: a change after that applies to the next session.
IReadOnlyList<CompanionPackage> GetCompanionPackages(ILogger log)
Parameters
logILoggerThe log of the session's load.
Returns
- IReadOnlyList<CompanionPackage>
The companions, each with its name, version and kind; the toolkit when it is written for one.
IsRestoredPackageExpected(string, PackageVersion, ILogger)
Whether the package the session restored for one of these companions is the one the host added. NuGet takes a package from any of its sources, so another source can serve another package with the same name and version. Called after the restore, before anything of the package loads; a companion that fails the check is not loaded.
bool IsRestoredPackageExpected(string name, PackageVersion version, ILogger log)
Parameters
namestringThe name of the companion.
versionPackageVersionIts version.
logILoggerThe log of the session's load, where the source says why a package fails the check.
Returns
- bool
truewhen the restored package can load.