Esempio n. 1
0
        public static LockFileProjectLibrary CreateLockFileProjectLibrary(Runtime.Project project,
                                                                          Runtime.Project projectDependency)
        {
            var result = new LockFileProjectLibrary()
            {
                Name = projectDependency.Name,
                Version = projectDependency.Version
            };

            result.Path = PathUtility.GetRelativePath(project.ProjectFilePath, projectDependency.ProjectFilePath, '/');

            return result;
        }
Esempio n. 2
0
        public static LockFileProjectLibrary CreateLockFileProjectLibrary(LockFileProjectLibrary previousLibrary,
                                                                          Runtime.Project project,
                                                                          Runtime.Project library)
        {
            var result = new LockFileProjectLibrary()
            {
                Name = library.Name,
                Version = library.Version
            };

            if (previousLibrary?.Name == library.Name && previousLibrary?.Version == library.Version)
            {
                result.Path = previousLibrary.Path;
            }
            else
            {
                result.Path = PathUtility.GetRelativePath(project.ProjectFilePath, library.ProjectFilePath, '/');
            }

            return result;
        }
Esempio n. 3
0
        public static LockFileTargetLibrary CreateLockFileTargetLibrary(LockFileProjectLibrary library,
                                                                        Runtime.Project projectInfo,
                                                                        RestoreContext context)
        {
            var lockFileLib = new LockFileTargetLibrary
            {
                Name = library.Name,
                Version = library.Version,
                Type = "project"
            };

            var targetFrameworkInfo = projectInfo.GetTargetFramework(context.FrameworkName);
            var dependencies = projectInfo.Dependencies.Concat(targetFrameworkInfo.Dependencies);

            foreach (var dependency in dependencies)
            {
                if (dependency.LibraryRange.IsGacOrFrameworkReference)
                {
                    lockFileLib.FrameworkAssemblies.Add(
                        LibraryRange.GetAssemblyName(dependency.LibraryRange.Name));
                }
                else
                {
                    lockFileLib.Dependencies.Add(new PackageDependency(
                        dependency.LibraryRange.Name,
                        dependency.LibraryRange.VersionRange));
                }
            }

            return lockFileLib;
        }