예제 #1
0
        public ProjectContext(LockFile lockFile, LockFileTarget lockFileTarget,
                              //  Trimmed from publish output, and if there are no runtimeFrameworks, written to runtimeconfig.json
                              LockFileTargetLibrary platformLibrary,
                              //  Written to runtimeconfig.json
                              RuntimeFramework[] runtimeFrameworks,
                              bool isFrameworkDependent)
        {
            Debug.Assert(lockFile != null);
            Debug.Assert(lockFileTarget != null);
            if (isFrameworkDependent)
            {
                Debug.Assert(platformLibrary != null ||
                             (runtimeFrameworks != null && runtimeFrameworks.Any()));
            }

            _lockFile       = lockFile;
            _lockFileTarget = lockFileTarget;
            if (string.IsNullOrEmpty(lockFileTarget.RuntimeIdentifier))
            {
                CompilationLockFileTarget = lockFileTarget;
            }
            else
            {
                var frameworkAlias = lockFile.GetLockFileTargetAlias(lockFileTarget);
                CompilationLockFileTarget = lockFile.GetTargetAndThrowIfNotFound(frameworkAlias, null);
            }

            PlatformLibrary      = platformLibrary;
            RuntimeFrameworks    = runtimeFrameworks;
            IsFrameworkDependent = isFrameworkDependent;
        }