128
129
using (StreamWriter sw = new StreamWriter (file, false, Encoding.UTF8)) {
129
130
sw.NewLine = "\r\n";
133
sw.WriteLine ("Microsoft Visual Studio Solution File, Format Version 9.00");
135
sw.WriteLine ("# Visual Studio 2005");
138
monitor.BeginTask (GettextCatalog.GetString ("Saving projects"), 1);
139
WriteProjects (c, c.BaseDirectory, sw, monitor);
142
132
SlnData slnData = GetSlnData (c);
143
133
if (slnData == null) {
144
134
// If a non-msbuild project is being converted by just
145
135
// changing the fileformat, then create the SlnData for it
146
136
slnData = new SlnData ();
147
137
c.ExtendedProperties [typeof (SlnFileFormat)] = slnData;
149
//Write the lines for unknownProjects
150
foreach (string l in slnData.UnknownProjects)
142
sw.WriteLine ("Microsoft Visual Studio Solution File, Format Version " + slnData.VersionString);
143
sw.WriteLine (slnData.HeaderComment);
146
monitor.BeginTask (GettextCatalog.GetString ("Saving projects"), 1);
147
WriteProjects (c, c.BaseDirectory, sw, monitor);
150
//Write the lines for unknownProjects
151
foreach (string l in slnData.UnknownProjects)
154
154
//Write the Globals
155
155
sw.WriteLine ("Global");
501
if (!projectPath.StartsWith("http://") &&
502
(projectPath.EndsWith (".csproj") || projectPath.EndsWith (".vbproj")))
504
DotNetProject project = null;
505
string path = SlnMaker.MapPath (Path.GetDirectoryName (fileName), projectPath);
506
if (String.IsNullOrEmpty (path)) {
507
monitor.ReportWarning (GettextCatalog.GetString (
508
"Invalid project path found in {0} : {1}", fileName, projectPath));
509
Console.WriteLine (GettextCatalog.GetString (
510
"Invalid project path found in {0} : {1}", fileName, projectPath));
511
if (projectPath.StartsWith("http://")) {
512
monitor.ReportWarning (GettextCatalog.GetString (
513
"{0}({1}): Projects with non-local source (http://...) not supported. '{2}'.",
514
fileName, sec.Start + 1, projectPath));
515
data.UnknownProjects.AddRange (lines.GetRange (sec.Start, sec.Count));
519
DotNetProject project = null;
520
string path = SlnMaker.MapPath (Path.GetDirectoryName (fileName), projectPath);
521
if (String.IsNullOrEmpty (path)) {
522
monitor.ReportWarning (GettextCatalog.GetString (
523
"Invalid project path found in {0} : {1}", fileName, projectPath));
524
LoggingService.LogWarning (GettextCatalog.GetString (
525
"Invalid project path found in {0} : {1}", fileName, projectPath));
530
projectPath = Path.GetFullPath (path);
532
project = Services.ProjectService.ReadCombineEntry (projectPath, monitor) as DotNetProject;
533
if (project == null) {
534
LoggingService.LogError ("Internal Error: Didn't get the expected DotNetProject for {0} project.",
515
projectPath = Path.GetFullPath (path);
517
project = Services.ProjectService.ReadCombineEntry (projectPath, monitor) as DotNetProject;
518
if (project == null) {
519
Console.WriteLine ("Internal Error: Didn't get the expected DotNetProject for {0} project.",
524
MSBuildData msdata = Utils.GetMSBuildData (project);
525
entries [projectGuid] = project;
526
data.ProjectsByGuid [msdata.Guid] = project;
528
msdata.Extra = lines.GetRange (sec.Start + 1, sec.Count - 2);
529
} catch (Exception e) {
530
Console.WriteLine ("Error while trying to load the project {0}", projectPath);
531
Console.WriteLine (e);
532
monitor.ReportWarning (GettextCatalog.GetString (
533
"Error while trying to load the project {0}. Exception : {1}", projectPath, e.Message));
536
data.UnknownProjects.AddRange (lines.GetRange (sec.Start, sec.Count));
539
MSBuildData msdata = Utils.GetMSBuildData (project);
540
entries [projectGuid] = project;
541
data.ProjectsByGuid [msdata.Guid] = project;
543
msdata.Extra = lines.GetRange (sec.Start + 1, sec.Count - 2);
544
} catch (Exception e) {
545
LoggingService.LogError (GettextCatalog.GetString (
546
"Error while trying to load the project {0}. Exception : {1}",
547
projectPath, e.ToString ()));
548
monitor.ReportWarning (GettextCatalog.GetString (
549
"Error while trying to load the project {0}. Exception : {1}", projectPath, e.Message));
552
data.UnknownProjects.AddRange (lines.GetRange (sec.Start, sec.Count));
540
//FIXME: Non .csproj/.vbproj projects not supported (yet)
541
monitor.ReportWarning (GettextCatalog.GetString (
542
"{0}({1}): Unsupported or unrecognized project : '{2}'. See logs.", fileName, sec.Start + 1, projectPath));
544
data.UnknownProjects.AddRange (lines.GetRange (sec.Start, sec.Count));
546
555
monitor.EndTask ();
694
703
action = "Build.0";
695
704
left = left.Substring (0, left.Length - 8);
697
Console.WriteLine ("{0} ({1}) : Warning: Unknown action. Only ActiveCfg & Build.0 supported.",
698
sln.FileName, lineNum + 1);
706
LoggingService.LogWarning (GettextCatalog.GetString ("{0} ({1}) : Unknown action. Only ActiveCfg & Build.0 supported.",
707
sln.FileName, lineNum + 1));
702
711
string [] t = left.Split (new char [] {'.'}, 2);
703
712
if (t.Length < 2) {
704
Console.WriteLine ("{0} ({1}) : Warning: Invalid format of the left side. Ignoring",
713
LoggingService.LogDebug ("{0} ({1}) : Invalid format of the left side. Ignoring",
705
714
sln.FileName, lineNum + 1);