diff options
author | Lluis Sanchez <lluis@novell.com> | 2009-08-11 05:31:59 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2009-08-11 05:31:59 +0400 |
commit | 5a31585c8105387dc721a696fec86a50492e04e7 (patch) | |
tree | 6da5262933f29c44ad5e734866d4ea561332c699 /main/src/addins/prj2make-sharp-lib | |
parent | dc00ba78e1805e0934f1450a024bd6e0d45530e9 (diff) |
* VS2003ProjectFileFormat.cs: Add support for reading vs2003
projects and solutions when not running in the IDE.
svn path=/trunk/monodevelop/; revision=139679
Diffstat (limited to 'main/src/addins/prj2make-sharp-lib')
-rw-r--r-- | main/src/addins/prj2make-sharp-lib/ChangeLog | 5 | ||||
-rw-r--r-- | main/src/addins/prj2make-sharp-lib/VS2003ProjectFileFormat.cs | 66 |
2 files changed, 44 insertions, 27 deletions
diff --git a/main/src/addins/prj2make-sharp-lib/ChangeLog b/main/src/addins/prj2make-sharp-lib/ChangeLog index c794f9b64e..e414131f51 100644 --- a/main/src/addins/prj2make-sharp-lib/ChangeLog +++ b/main/src/addins/prj2make-sharp-lib/ChangeLog @@ -1,3 +1,8 @@ +2009-08-11 Lluis Sanchez Gual <lluis@novell.com> + + * VS2003ProjectFileFormat.cs: Add support for reading vs2003 + projects and solutions when not running in the IDE. + 2009-08-10 Lluis Sanchez Gual <lluis@novell.com> * prj2make-sharp-lib.csproj: Don't make local copies of diff --git a/main/src/addins/prj2make-sharp-lib/VS2003ProjectFileFormat.cs b/main/src/addins/prj2make-sharp-lib/VS2003ProjectFileFormat.cs index 190d9229bb..fa40bfeaa2 100644 --- a/main/src/addins/prj2make-sharp-lib/VS2003ProjectFileFormat.cs +++ b/main/src/addins/prj2make-sharp-lib/VS2003ProjectFileFormat.cs @@ -114,47 +114,59 @@ namespace MonoDevelop.Prj2Make public object ReadProjectFile (FilePath fileName, IProgressMonitor monitor) { - TargetConvert choice = IdeApp.IsInitialized ? GuiHelper.QueryProjectConversion (fileName) : TargetConvert.None; - if (choice == TargetConvert.None) - throw new InvalidOperationException ("VS2003 projects are not supported natively."); + if (IdeApp.IsInitialized) { + TargetConvert choice = GuiHelper.QueryProjectConversion (fileName); + if (choice == TargetConvert.None) + throw new InvalidOperationException ("VS2003 projects are not supported natively."); + + DotNetProject 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"); + } - DotNetProject 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 { + DotNetProject project = ImportCsproj (fileName); + project.FileName = fileName; + return project; } - - project.Save (monitor); - return project; }
public object ReadSolutionFile (FilePath fileName, IProgressMonitor monitor) { - TargetConvert choice = IdeApp.IsInitialized ? GuiHelper.QuerySolutionConversion (fileName) : TargetConvert.None; - if (choice == TargetConvert.None) - throw new InvalidOperationException ("VS2003 solutions are not supported natively."); + 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); + 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); - } + 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; + solution.Save (monitor); + return solution; + } + else + return ImportSln (fileName); }
internal DotNetProject ImportCsproj (FilePath fileName) { DotNetProject project = null; SlnMaker slnmaker = new SlnMaker (); - try { - using (IProgressMonitor m = GuiHelper.CreateProgressMonitor ()) { + try { + IProgressMonitor m = IdeApp.IsInitialized ? GuiHelper.CreateProgressMonitor () : new ConsoleProgressMonitor (); + using (m) { project = slnmaker.CreatePrjxFromCsproj (fileName, m); } } catch (Exception e) { @@ -180,7 +192,7 @@ namespace MonoDevelop.Prj2Make { SlnMaker slnmaker = new SlnMaker (); Solution solution = null; - IProgressMonitor m = GuiHelper.CreateProgressMonitor (); + IProgressMonitor m = IdeApp.IsInitialized ? GuiHelper.CreateProgressMonitor () : new ConsoleProgressMonitor (); try { solution = slnmaker.MsSlnToCmbxHelper (fileName, m); |