Change packages source from Essential Studio to NuGet for all Solution

Hi
I have a solution which include about 150 projects and about 20..25 projects use Syncfusion compontents.
I use Essential Studio for add Syncfusion assemblies to projects. It is easy, just drag and drop component from ToolBox.
But now I want to switch to use NuGet manager.
I found instruction (https://help.syncfusion.com/extension/syncfusion-nuget-packages/nuget-packages) where I readed how to add package with Nuget, how to Licensing components.
But in my solution I have about 20...25 projects, in each of them 3..5 syncfusion's assemblies. If I will use to NuGet package manager manually, I have to remove and install about 100 nuget packages.
It's a very bumpy road.

Is there are way for automation change all project's references from GAS (Essential Studio) to Nuget packeges in solution?

3 Replies

GR Ganesan Rengasamy Syncfusion Team May 8, 2020 06:13 AM UTC

Hi Dmitry,

As of now, we don't have the system to update the Syncfusion assemblies from GAC to the NuGet packages. You have to install the Syncfusion NuGet packages manually in your all projects. The Gac assemblies will be replaced with NuGet assembly location.  You can find the NuGet package for the corresponding assemblies for control wise. 
  
You can use the Manager NuGet Packages for solution in the solution explore by right clicking on the solution file to install the same NuGet package in multiple projects by choosing required projects. 

Regards,
Ganesan Rengasamy.



DM Dmitry replied to Ganesan Rengasamy May 9, 2020 09:43 AM UTC

Hi Dmitry,

As of now, we don't have the system to update the Syncfusion assemblies from GAC to the NuGet packages. You have to install the Syncfusion NuGet packages manually in your all projects. The Gac assemblies will be replaced with NuGet assembly location.  You can find the NuGet package for the corresponding assemblies for control wise. 
  
You can use the Manager NuGet Packages for solution in the solution explore by right clicking on the solution file to install the same NuGet package in multiple projects by choosing required projects. 

Regards,
Ganesan Rengasamy.


Ganesan Rengasamy, thanks!

To use Manager NuGet for solution is good way.
But, you need to think a lot. I'm lazy :)
Tips of to use Manager NuGet for solution got me thinking.
I wrote a little code in unit test project.
In Output I got list of NuGet install commands.
This command list I inserted into console of NuGet.
May be it will be usefull for someone.

        [TestMethod]
        public void TestMethod1()
        {
            var pathLog = @"D:\SVN\?????\trunk";
            var fileNameList = Directory.GetFiles(pathLog, "*.csproj", SearchOption.AllDirectories);
            var fileList = fileNameList.Select(c => new FileInfo(c));
            foreach (var f in fileList)
            {
                //Trace.TraceInformation(f.FullName);
                ProcessProjectFile(f);
            }
        }

        private void ProcessProjectFile(FileInfo f)
        {
            var projectName = f.Name.Replace(".csproj", "");
            //Trace.TraceInformation($"PROJECT: {projectName}");
            var lines = File.ReadAllLines(f.FullName);
            foreach (var s in lines)
            {
                if (s.Contains("Include=\"Syncfusion."))
                {
                    //Trace.TraceInformation($" - {s}");
                    ParseSfAssembly(projectName, s);
                }
            }
        }

        private void ParseSfAssembly(string projectName, string line)
        {
            var regex = new Regex(@"(
            var match = regex.Match(line);
            if (match.Success)
            {
                var sfName = $"{match.Groups[3]}{match.Groups[4]}";
                //var sfVer = match.Groups[8];
                var sfVer = "18.1.0.42";
                Trace.TraceInformation($"Install-Package {sfName} -ProjectName {projectName} -Version {sfVer}");
            }
        }
    }


GR Ganesan Rengasamy Syncfusion Team May 11, 2020 06:20 AM UTC

Hi Dmitry,

Thanks for your update with a valuable code for upgrade the Syncfusion Assemblies from GAC to NuGet packages. We will check this from our side and make it as a tool.

Regards,
Ganesan Rengasamy. 


Loader.
Up arrow icon