Given path to sln file or project file.
It starts in SessionViewModel.OpenSession with a call to PackageSession.Load.
-> writes into sessionResult
then it calls PackageSession.LoadMissingReferences
finally we create a new SessionViewModel on the UI thread and call LoadAssetsFromPackages on it.
PackageSession.Load
- Creates a new PackageSession
- this holds information about project solution (Stride.Core.VisualStudio abstraction) and collection of projects and packages referenced
- If file is a project calls
.LoadProjectand then.Projects.AddIf file is solution, it parses the solution and for C# projects invokes.LoadProject, assigns the solution reference to project and calls.Projects.AddThen calls.LoadMissingDependencieswhich loads referenced dependencies - Calls
.LoadMissingReferences - Runs
PackageSessionAnalysisover the session - Runs custom analysis implementations from packages (currently none) plugin point
PackageAnalysis
- Converts absolute paths to relative in assets
- Tries to update Root assets collection in case there's mismatches Guid/Url
- Runs
AssetAnalysisover assets, which updates references between assets
PackageSession.LoadProject
- Calls
Package.LoadProject - Checks if project is legacy Xenko and can be upgraded
- Assigns Meta .Name if missing
- Adds version constraint if present
Package.LoadProject - supports both projects and packages
- If file is a project (
.*proj)- Checks if
.sdpkgfile exists and if the xenko version needs to be renamed - If
.sdkpgexists callsLoadRawelse creates a new dirty package with default parameters
- Checks if
- If file is
.sdpkgcallsLoadRaw- If there's a
.csprojnext to it, treats it like above - otherwise looks for a
.nuspecfile with same name as package in..directory, ensures package directory is calledstrideand parses name of nuspec directory to get package version (assumes being served from NuGet cache)
- If there's a
PackageContainer -> SolutionProject -> StandalonePackage
Package.LoadRaw calls AssetMigration.MigrateAssetIfNeeded and AssetFileSerializer.Load<Package> to deserialize the package.
PackageSession.PreLoadPackageDependencies
- uses
Microsoft.Build.Evaluation.ProjectCollectionto parse *proj file - reads properties (version, name), references
- something about package version upgrades
- Then for each package reference, try upgrade
- NuGet Restore using
VSProjectHelper.RestoreNugetPackages - Calls
PackageSession.UpdateDependencies - Registers dependencies in AssemblyContainer (core.reflection)
- Loads dependencies via
PackageSession.LoadProject
PackageSession.UpdateDependencies
- Assumes
objfolder location and tries to read theproject.assets.json - Resolves assembly paths from referenced dependencies (and some metadata).
NOTE: when package is a dependency but with PrivateAssets=all and no assembly reference, it effectively doesn't have any metadata in
project.assets.jsonso we won't correctly read it out. We need to somehow populate the CompileTimeAssemblies