diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2013-08-28 18:34:14 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2013-08-28 18:34:14 +0400 |
commit | f7123deb79170b252ced2ff32d8ec473d62f93ad (patch) | |
tree | b0f1cf438d80a68b3fe9a60842fd29eb7263369f /main/src/core/MonoDevelop.Projects.Formats.MSBuild | |
parent | df84b67121ed3482fc9b5d1a728a7ed0898c7cce (diff) |
Revert "Revert "Revert "Revert "MSBuild support fixes""""
This reverts commit c8b3f434f7795e6b0f4d4d290343381de191cadd.
Diffstat (limited to 'main/src/core/MonoDevelop.Projects.Formats.MSBuild')
3 files changed, 31 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.cs index 315bd88b46..6644ad3f79 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.cs @@ -46,6 +46,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild ManualResetEvent doneEvent = new ManualResetEvent (false); Dictionary<string,Engine> engines = new Dictionary<string, Engine> (); + Dictionary<string,string> unsavedProjects = new Dictionary<string, string> (); public void Dispose () { @@ -92,6 +93,9 @@ namespace MonoDevelop.Projects.Formats.MSBuild internal void UnloadProject (string file) { + lock (unsavedProjects) + unsavedProjects.Remove (file); + RunSTA (delegate { foreach (var engine in engines.Values) { var loadedProj = engine.GetLoadedProject (file); @@ -101,6 +105,21 @@ namespace MonoDevelop.Projects.Formats.MSBuild }); } + internal void SetUnsavedProjectContent (string file, string content) + { + lock (unsavedProjects) + unsavedProjects [file] = content; + } + + internal string GetUnsavedProjectContent (string file) + { + lock (unsavedProjects) { + string content; + unsavedProjects.TryGetValue (file, out content); + return content; + } + } + internal static void RunSTA (ThreadStart ts) { lock (workLock) { diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/IProjectBuilder.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/IProjectBuilder.cs index 167acc7240..8253c49b33 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/IProjectBuilder.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/IProjectBuilder.cs @@ -34,6 +34,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild MSBuildVerbosity verbosity); string[] GetAssemblyReferences (ProjectConfigurationInfo[] configurations); void Refresh (); + void RefreshWithContent (string projectContent); } [Serializable] diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs index 20a59ab9e4..56960f921d 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs @@ -63,6 +63,12 @@ namespace MonoDevelop.Projects.Formats.MSBuild buildEngine.UnloadProject (file); } + public void RefreshWithContent (string projectContent) + { + buildEngine.UnloadProject (file); + buildEngine.SetUnsavedProjectContent (file, projectContent); + } + void LogWriteLine (string txt) { if (currentLogWriter != null) @@ -145,7 +151,11 @@ namespace MonoDevelop.Projects.Formats.MSBuild var p = engine.GetLoadedProject (pc.ProjectFile); if (p == null) { p = new Project (engine); - p.Load (pc.ProjectFile); + var content = buildEngine.GetUnsavedProjectContent (pc.ProjectFile); + if (content == null) + p.Load (pc.ProjectFile); + else + p.Load (new StringReader (content)); } p.GlobalProperties.SetProperty ("Configuration", pc.Configuration); if (!string.IsNullOrEmpty (pc.Platform)) |