コード例 #1
0
        public object ReadSolutionFile(FilePath fileName, IProgressMonitor monitor)
        {
            if (IdeApp.IsInitialized)
            {
                TargetConvert choice = GuiHelper.QuerySolutionConversion(fileName);
                if (choice == TargetConvert.None)
                {
                    throw new InvalidOperationException("VS2003 solutions are not supported natively.");
                }

                Solution solution = ImportSln(fileName);

                if (choice == TargetConvert.MonoDevelop)
                {
                    solution.ConvertToFormat(IdeApp.Services.ProjectService.FileFormats.GetFileFormat("MD1"), true);
                }
                else if (choice == TargetConvert.VisualStudio)
                {
                    solution.ConvertToFormat(IdeApp.Services.ProjectService.FileFormats.GetFileFormat("MSBuild05"), true);
                }

                solution.Save(monitor);
                return(solution);
            }
            else
            {
                return(ImportSln(fileName));
            }
        }
コード例 #2
0
        public object ReadProjectFile(FilePath fileName, IProgressMonitor monitor)
        {
            if (IdeApp.IsInitialized)
            {
                TargetConvert choice = GuiHelper.QueryProjectConversion(fileName);
                if (choice == TargetConvert.None)
                {
                    throw new InvalidOperationException("VS2003 projects are not supported natively.");
                }

                SolutionEntityItem project = ImportCsproj(fileName);
                project.FileName = fileName;

                if (choice == TargetConvert.MonoDevelop)
                {
                    project.FileFormat = IdeApp.Services.ProjectService.FileFormats.GetFileFormat("MD1");
                }
                else if (choice == TargetConvert.VisualStudio)
                {
                    project.FileFormat = IdeApp.Services.ProjectService.FileFormats.GetFileFormat("MSBuild05");
                }

                project.Save(monitor);
                return(project);
            }
            else
            {
                SolutionEntityItem project = ImportCsproj(fileName);
                project.FileName = fileName;
                return(project);
            }
        }