Example #1
0
        private void ConvertProjectReferences(ProjectDocument project)
        {
            if (Path.GetExtension(Args.ProjectFile) == ".sfproj")
            {
                return;
            }

            Console.Write("Resolving project references... ");

            foreach (var reference in project.GetProjectReferences())
            {
                string name = null;
                foreach (var check in Util.LocalNameToProjectNames(reference.Name))
                {
                    if (m_log.ContainsKey(check))
                    {
                        name = check;
                        break;
                    }
                }

                if (name == null)
                {
                    throw new InvalidOperationException(
                              $@"Referenced project '{reference.Name}' was not found in 'packages.config'.
Please add it as a NuGet reference first, and only after that you can convert it into project reference.");
                }

                m_log[name].ProjectReference = true;

                var framework = m_checker.TargetFramework(name);
                if (framework != null)
                {
                    reference.ConvertToBinary(framework.Value, name);
                }
            }

            Console.WriteLine("OK");
        }