Example #1
0
        /// <summary>
        /// Replaces PackageReference references marked with the
        /// Temp attribute to Reference. Transitive dependencies
        /// will be included.
        /// </summary>
        ///
        /// <exception cref="SwitcherFileNotFoundException"/>
        ///
        /// <exception cref="FileNotFoundException"/>
        ///
        /// <exception cref="ArgumentException">
        public override IEnumerable <string> Switch()
        {
            void Executor(IProjectReference reference, LockFileTargetLibrary library, string absolutePath)
            {
                SwitchSysDependency(reference, library);
                SwitchPkgDependency(reference, library, absolutePath);
            }

            IterateAndExecute(ProjectProvider.GetLoadedProject(), Executor);

            return(default);
Example #2
0
        /// <summary>
        /// Replaces ProjectReference references marked
        /// with the Temp attribute to PackageReference.
        /// </summary>
        ///
        /// <exception cref="SwitcherException"/>
        public override IEnumerable <string> Switch()
        {
            HashSet <string> output = new
                                      HashSet <string>
                                          ();

            MessageProvider.Clear();

            foreach (IProjectReference reference in ProjectProvider.GetLoadedProject())
            {
                output.UnionWith(SwitchDependency(reference, ReferenceType.Reference));
                output.UnionWith(SwitchDependency(reference, ReferenceType.ProjectReference));

                reference.Save();
            }

            RemoveFromSolution(ProjectProvider.Solution, output);

            return(output);
        }
Example #3
0
        /// <summary>
        /// Replaces PackageReference references marked
        /// with the Temp attribute to ProjectReference.
        /// Transitive dependencies will be included.
        /// </summary>
        ///
        /// <exception cref="SwitcherFileNotFoundException"/>
        ///
        /// <exception cref="FileNotFoundException"/>
        ///
        /// <exception cref="ArgumentException">
        ///
        /// <remarks>
        /// All projects detected during
        /// the work will be included in
        /// the solution.
        /// </remarks>
        public override IEnumerable <string> Switch()
        {
            HashSet <string> output = new
                                      HashSet <string>
                                          ();

            IEnumerable <IProjectReference> references = ProjectProvider.GetLoadedProject();

            void Executor(IProjectReference reference, LockFileTargetLibrary library, string absolutePath)
            {
                SwitchSysDependency(reference, library);
                SwitchPkgDependency(reference, library, absolutePath);

                output.Add(absolutePath);
            }

            IterateAndExecute(references, Executor);

            AddToSolution(ProjectProvider.Solution, output);

            return(output);
        }