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
.LoadProject
and then.Projects.Add
If file is solution, it parses the solution and for C# projects invokes.LoadProject
, assigns the solution reference to project and calls.Projects.Add
Then calls.LoadMissingDependencies
which loads referenced dependencies - Calls
.LoadMissingReferences
- Runs
PackageSessionAnalysis
over 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
AssetAnalysis
over 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
.sdpkg
file exists and if the xenko version needs to be renamed - If
.sdkpg
exists callsLoadRaw
else creates a new dirty package with default parameters
- Checks if
- If file is
.sdpkg
callsLoadRaw
- If there's a
.csproj
next to it, treats it like above - otherwise looks for a
.nuspec
file with same name as package in..
directory, ensures package directory is calledstride
and 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.ProjectCollection
to 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
obj
folder 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.json
so we won't correctly read it out. We need to somehow populate the CompileTimeAssemblies