diff options
author | Lluis Sanchez Gual <lluis@xamarin.com> | 2013-08-21 14:51:08 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2013-08-27 20:05:22 +0400 |
commit | 6e1037d71191077ff5ef920107d81258d4abb4d3 (patch) | |
tree | bb288af6c7b6c9a4929da0acacae4e78c2af9dfb /main/src/core/MonoDevelop.Projects.Formats.MSBuild | |
parent | c2a5b8ecde248ffa0c587ff1ed1b2e60de3036dc (diff) |
Revert "Revert "MSBuild support fixes""
This reverts commit 77beefd0e767d941f3d2f90eb64d2a4d68313afc.
Conflicts:
main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
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)) |