diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Core')
22 files changed, 135 insertions, 60 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntime.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntime.cs index 837dac0d7a..84fc117ddc 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntime.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntime.cs @@ -241,7 +241,10 @@ namespace MonoDevelop.Core.Assemblies return; foreach (string pcfile in GetAllPkgConfigFiles ()) { try { - ParsePCFile (new FilePath (pcfile).ResolveLinks ()); + var pc = new FilePath (pcfile).ResolveLinks (); + if (!string.IsNullOrEmpty (pc)) + ParsePCFile (pc); + if (ShuttingDown) return; } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/TimeCounter.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/TimeCounter.cs index 55227a859f..051e80845e 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/TimeCounter.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/TimeCounter.cs @@ -26,6 +26,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; namespace MonoDevelop.Core.Instrumentation { @@ -52,7 +53,7 @@ namespace MonoDevelop.Core.Instrumentation class TimeCounter: ITimeTracker { - DateTime begin; + Stopwatch stopWatch = new Stopwatch (); TimerTraceList traceList; TimerTrace lastTrace; TimerCounter counter; @@ -97,16 +98,18 @@ namespace MonoDevelop.Core.Instrumentation internal void Begin () { - begin = DateTime.Now; + stopWatch.Start (); } public void End () { - if (counter == null) { + if (!stopWatch.IsRunning) { Console.WriteLine ("Timer already finished"); return; } - traceList.TotalTime = DateTime.Now - begin; + + stopWatch.Stop (); + traceList.TotalTime = TimeSpan.FromMilliseconds (stopWatch.ElapsedMilliseconds); if (traceList.TotalTime.TotalSeconds < counter.MinSeconds) counter.RemoveValue (traceList.ValueIndex); else @@ -118,7 +121,7 @@ namespace MonoDevelop.Core.Instrumentation t.Dispose (); } else if (linkedTrackers != null) ((IDisposable)linkedTrackers).Dispose (); - + stopWatch.Reset (); } void IDisposable.Dispose () diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Logging/FileLogger.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Logging/FileLogger.cs index 317c9134ba..3d39961f7b 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Logging/FileLogger.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Logging/FileLogger.cs @@ -45,7 +45,9 @@ namespace MonoDevelop.Core.Logging public FileLogger (string filename, bool append) { - writer = new StreamWriter (filename, append); + writer = new StreamWriter (filename, append) { + AutoFlush = true + }; name = filename; } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs index 82410eae20..90cecfdb54 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs @@ -51,15 +51,12 @@ namespace MonoDevelop.Core.ProgressMonitoring public ConsoleProgressMonitor () : this (Console.Out, true) { //TODO: can we efficiently update Console.WindowWidth when it changes? - // TODO: Use Console.IsOutputRedirected in .NET 4.5. - try { - columns = Console.WindowWidth; - } //when the output is redirected, Mono returns 0 but .NET throws IOException - catch (IOException) { + if (Console.IsOutputRedirected) columns = 0; - } - + else + columns = Console.WindowWidth; + wrap = columns > 0; } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs index 893ca1d520..d93a7257d6 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs @@ -69,13 +69,13 @@ namespace MonoDevelop.Core const int PATHMAX = 4096 + 1; - static readonly char[] invalidPathChars = Path.GetInvalidPathChars ().Concat ("#%&").ToArray (); + static readonly char[] invalidPathChars = Path.GetInvalidPathChars ().Concat ("#%").ToArray (); public static char[] GetInvalidPathChars() { return (char[])invalidPathChars.Clone(); } - static readonly char[] invalidFileNameChars = Path.GetInvalidFileNameChars ().Concat ("#%&").ToArray (); + static readonly char[] invalidFileNameChars = Path.GetInvalidFileNameChars ().Concat ("#%").ToArray (); public static char[] GetInvalidFileNameChars () { return (char[])invalidFileNameChars.Clone (); @@ -123,10 +123,12 @@ namespace MonoDevelop.Core if (string.IsNullOrEmpty (fileName)) return FilePath.Empty; string fp = Path.GetFullPath (fileName); - if (fp.Length > 0 && fp [fp.Length - 1] == Path.DirectorySeparatorChar) - return fp.TrimEnd (Path.DirectorySeparatorChar); - if (fp.Length > 0 && fp [fp.Length - 1] == Path.AltDirectorySeparatorChar) - return fp.TrimEnd (Path.AltDirectorySeparatorChar); + if (fp.Length > 0) { + if (fp [fp.Length - 1] == Path.DirectorySeparatorChar) + return fp.TrimEnd (Path.DirectorySeparatorChar); + if (fp [fp.Length - 1] == Path.AltDirectorySeparatorChar) + return fp.TrimEnd (Path.AltDirectorySeparatorChar); + } return fp; } }
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Gettext.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Gettext.cs index a3444fa3e4..db19326ea8 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Gettext.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Gettext.cs @@ -43,6 +43,8 @@ namespace MonoDevelop.Core [DllImport ("kernel32.dll", SetLastError = true)]
static extern int SetThreadUILanguage (int LangId);
+ const int LOCALE_CUSTOM_UNSPECIFIED = 4096;
+
static GettextCatalog ()
{
mainThread = Thread.CurrentThread;
@@ -59,7 +61,7 @@ namespace MonoDevelop.Core if (ci.IsNeutralCulture) {
// We need a non-neutral culture
foreach (CultureInfo c in CultureInfo.GetCultures (CultureTypes.AllCultures & ~CultureTypes.NeutralCultures))
- if (c.Parent != null && c.Parent.Name == ci.Name) {
+ if (c.Parent != null && c.Parent.Name == ci.Name && c.LCID != LOCALE_CUSTOM_UNSPECIFIED) {
ci = c;
break;
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs index b2c15f9a0e..bda363cc1d 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs @@ -36,6 +36,7 @@ using Mono.Addins; using MonoDevelop.Core.LogReporting; using MonoDevelop.Core.Logging; using Mono.Unix.Native; +using System.Text; namespace MonoDevelop.Core { @@ -492,20 +493,39 @@ namespace MonoDevelop.Core #endregion #region convenience methods (string message, Exception ex) - + + static string FormatExceptionText (string message, Exception ex) + { + if (ex == null) + return message; + + var exceptionText = new StringBuilder (); + exceptionText.AppendLine (message); + exceptionText.Append (ex); + if (ex.Data.Count > 0) { + exceptionText.AppendLine (); + exceptionText.Append ("Exception Data:"); + foreach (DictionaryEntry item in ex.Data) { + exceptionText.AppendLine (); + exceptionText.AppendFormat ("{0}: {1}", item.Key, item.Value); + } + } + return exceptionText.ToString (); + } + public static void LogDebug (string message, Exception ex) { - Log (LogLevel.Debug, message + (ex != null? Environment.NewLine + ex : string.Empty)); + Log (LogLevel.Debug, FormatExceptionText (message, ex)); } public static void LogInfo (string message, Exception ex) { - Log (LogLevel.Info, message + (ex != null? Environment.NewLine + ex : string.Empty)); + Log (LogLevel.Info, FormatExceptionText (message, ex)); } public static void LogWarning (string message, Exception ex) { - Log (LogLevel.Warn, message + (ex != null? Environment.NewLine + ex : string.Empty)); + Log (LogLevel.Warn, FormatExceptionText (message, ex)); } public static void LogError (string message, Exception ex) @@ -516,7 +536,7 @@ namespace MonoDevelop.Core [Obsolete ("Use LogError")] public static void LogUserError (string message, Exception ex) { - Log (LogLevel.Error, message + (ex != null? Environment.NewLine + ex : string.Empty)); + Log (LogLevel.Error, FormatExceptionText (message, ex)); } /// <summary> @@ -541,7 +561,7 @@ namespace MonoDevelop.Core /// <param name="ex">Exception</param> public static void LogInternalError (string message, Exception ex) { - Log (LogLevel.Error, message + (ex != null? Environment.NewLine + ex : string.Empty)); + Log (LogLevel.Error, FormatExceptionText (message, ex)); ReportUnhandledException (ex, false, true, "internal"); } @@ -560,7 +580,7 @@ namespace MonoDevelop.Core /// <param name="ex">Exception</param> public static void LogFatalError (string message, Exception ex) { - Log (LogLevel.Error, message + (ex != null? Environment.NewLine + ex : string.Empty)); + Log (LogLevel.Fatal, FormatExceptionText (message, ex)); ReportUnhandledException (ex, true, false, "fatal"); } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/SystemInformation.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/SystemInformation.cs index 69e83d4d0b..bbf4868d2e 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/SystemInformation.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/SystemInformation.cs @@ -120,6 +120,17 @@ namespace MonoDevelop.Core Title = "Operating System", Description = sb.ToString () }; + + string userAddins = string.Join (Environment.NewLine, + AddinManager.Registry.GetModules (AddinSearchFlags.IncludeAddins | AddinSearchFlags.LatestVersionsOnly) + .Where (addin => addin.IsUserAddin && addin.Enabled) + .Select (addin => string.Format ("{0} {1}", addin.Name, addin.Version)) + ); + if (!string.IsNullOrEmpty (userAddins)) + yield return new SystemInformationSection () { + Title = "Enabled user installed addins", + Description = userAddins, + }; } internal static string GetReleaseId () diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildFileFormat.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildFileFormat.cs index 05314dfdb7..814935bdbb 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildFileFormat.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildFileFormat.cs @@ -347,7 +347,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild protected override bool SupportsToolsVersion (string version) { - return version == "4.0" || version == "12.0"; + return version == "4.0" || version == "12.0" || version == "14.0"; } } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs index 8f1a2ac0de..fe62395a0d 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs @@ -119,6 +119,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild return SolutionFormat; return new MSBuildFileFormatVS12 (); case "12.0": + case "14.0": return new MSBuildFileFormatVS12 (); default: throw new Exception ("Unknown ToolsVersion '" + ToolsVersion + "'"); @@ -312,7 +313,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild newContext = new TargetEvaluationContext (newContext); var res = RunTarget (monitor, target, configuration, (TargetEvaluationContext) newContext); CallContext.SetData ("MonoDevelop.Projects.TargetEvaluationResult", res); - return res.BuildResult; + return res != null ? res.BuildResult : null; } finally { if (newContext != currentContext) CallContext.SetData ("MonoDevelop.Projects.ProjectOperationContext", currentContext); diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs index 51013f182a..c8efc96d0c 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs @@ -504,12 +504,16 @@ namespace MonoDevelop.Projects.Formats.MSBuild internal static RemoteProjectBuilder GetProjectBuilder (TargetRuntime runtime, string minToolsVersion, string file, string solutionFile) { lock (builders) { - //attempt to use 12.0 builder first if available - string toolsVersion = "12.0"; - string binDir = runtime.GetMSBuildBinPath ("12.0"); + //attempt to use 14.0 builder first if available + string toolsVersion = "14.0"; + string binDir = runtime.GetMSBuildBinPath ("14.0"); if (binDir == null) { - //fall back to 4.0, we know it's always available - toolsVersion = "4.0"; + toolsVersion = "12.0"; + binDir = runtime.GetMSBuildBinPath ("12.0"); + if (binDir == null) { + //fall back to 4.0, we know it's always available + toolsVersion = "4.0"; + } } //check the ToolsVersion we found can handle the project diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs index ab59a88e1d..57f2e797e5 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs @@ -159,7 +159,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild void CheckDisconnected () { - if (engine.CheckDisconnected ()) { + if (engine != null && engine.CheckDisconnected ()) { if (Disconnected != null) Disconnected (this, EventArgs.Empty); } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/SlnFileFormat.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/SlnFileFormat.cs index b1aacadd0e..0ebb7f4c4a 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/SlnFileFormat.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/SlnFileFormat.cs @@ -80,7 +80,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild monitor.BeginTask (GettextCatalog.GetString ("Saving solution: {0}", file), 1); try { if (File.Exists (file)) - tmpfilename = Path.GetTempFileName (); + tmpfilename = Path.GetDirectoryName (file) + Path.DirectorySeparatorChar + ".#" + Path.GetFileName (file); } catch (IOException) { } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Policies/PolicyService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Policies/PolicyService.cs index 0e7b6e5b61..e3604edc2d 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Policies/PolicyService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Policies/PolicyService.cs @@ -1240,6 +1240,11 @@ namespace MonoDevelop.Projects.Policies if (pset.Id == "Default") { defaultPolicies = pset; } else { + // if the policy file does not have a name, use the file name as one + if (!string.IsNullOrEmpty (pset.Name)) { + pset.Name = file.FileNameWithoutExtension; + } + AddUserPolicySet (pset); } xr.MoveToContent (); diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProject.cs index 099b33784e..112b9e8fb0 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProject.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.SharedAssetsProjects/SharedAssetsProject.cs @@ -223,7 +223,7 @@ namespace MonoDevelop.Projects.SharedAssetsProjects pref.Flags = ProjectItemFlags.DontPersist; pref.SetItemsProjectPath (ProjItemsPath); foreach (var f in Files) { - if (pref.OwnerProject.Files.GetFile (f.FilePath) == null) { + if (pref.OwnerProject.Files.GetFile (f.FilePath) == null && f.Subtype != Subtype.Directory) { var cf = (ProjectFile)f.Clone (); cf.Flags |= ProjectItemFlags.DontPersist | ProjectItemFlags.Hidden; pref.OwnerProject.Files.Add (cf); diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Text/TextFormatter.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Text/TextFormatter.cs index 4d6efb199a..aee449009a 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Text/TextFormatter.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Text/TextFormatter.cs @@ -113,6 +113,10 @@ namespace MonoDevelop.Projects.Text } } } + + public bool KeepLines { + get; set; + } public bool TabsAsSpaces { get { return tabsAsSpaces; } @@ -304,8 +308,12 @@ namespace MonoDevelop.Projects.Text void AppendCurrentWord (char separatorChar) { - if (currentWord.Length == 0) + if (currentWord.Length == 0) { + if (KeepLines && lineStart && separatorChar == '\n') { + AppendChar (separatorChar, true); + } return; + } if (Wrap == WrappingType.Word || Wrap == WrappingType.WordChar) { if (curCol + currentWord.Length > MaxColumns) { // If the last char was a word separator, remove it diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs index 28040d75c5..904ecdf71a 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs @@ -471,21 +471,28 @@ namespace MonoDevelop.Projects for (int n=0; n<References.Count; n++) { ProjectReference pr = References [n]; if (pr.ReferenceType == ReferenceType.Assembly && DefaultConfiguration != null) { - if (pr.GetReferencedFileNames (DefaultConfiguration.Selector).Any (f => f == updatedFile)) + if (pr.GetReferencedFileNames (DefaultConfiguration.Selector).Any (f => f == updatedFile)) { + SetFastBuildCheckDirty (); pr.NotifyStatusChanged (); + } } else if (pr.HintPath == updatedFile) { + SetFastBuildCheckDirty (); var nr = pr.GetRefreshedReference (); if (nr != null) References [n] = nr; } } + /* Removed because it is very slow. SetFastBuildCheckDirty() is being called above. It is not the perfect solution but it is good enough + * In the new project model GetReferencedAssemblies is asynchronous, so the code can be uncommented there. + // If a referenced assembly changes, dirtify the project. foreach (var asm in GetReferencedAssemblies (DefaultConfiguration.Selector)) if (asm == updatedFile) { SetFastBuildCheckDirty (); break; } + */ } internal override void OnFileChanged (object source, MonoDevelop.Core.FileEventArgs e) @@ -960,8 +967,11 @@ namespace MonoDevelop.Projects // Hack to keep backwards compatibility with the old behavior. For example, a MonoDroid project is a library, but OnGetSupportsExecute // is not overriden, so it depends on DotNetProject to return true by default. - if (compileTarget == CompileTarget.Library && GetType () == typeof (DotNetAssemblyProject)) - return false; + if (compileTarget == CompileTarget.Library) { + Type thisType = GetType (); + if (thisType == typeof (DotNetAssemblyProject) || thisType == typeof (PortableDotNetProject)) + return false; + } return true; } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs index 19b60f692b..524f7a6587 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs @@ -247,7 +247,7 @@ namespace MonoDevelop.Projects case "TARGETNAME": return conf.CompiledOutputName.FileName; case "TARGETDIR": return conf.CompiledOutputName.ParentDirectory; case "TARGETEXT": return conf.CompiledOutputName.Extension; - case "PROJECTCONFIG": return conf.Name + "." + conf.Platform; + case "PROJECTCONFIG": return string.IsNullOrEmpty (conf.Platform) ? conf.Name : conf.Name + "." + conf.Platform; case "PROJECTCONFIGNAME": return conf.Name; case "PROJECTCONFIGPLAT": return conf.Platform; } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs index a28e9009af..ce57c35a54 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs @@ -69,6 +69,8 @@ namespace MonoDevelop.Projects public TargetEvaluationResult RunTarget (IProgressMonitor monitor, string target, ConfigurationSelector configuration, TargetEvaluationContext context) { + var currentContext = CallContext.GetData ("MonoDevelop.Projects.ProjectOperationContext"); + var currentResult = CallContext.GetData ("MonoDevelop.Projects.TargetEvaluationResult"); try { CallContext.SetData ("MonoDevelop.Projects.ProjectOperationContext", context); CallContext.SetData ("MonoDevelop.Projects.TargetEvaluationResult", null); @@ -82,8 +84,8 @@ namespace MonoDevelop.Projects } return new TargetEvaluationResult (r); } finally { - CallContext.SetData ("MonoDevelop.Projects.ProjectOperationContext", null); - CallContext.SetData ("MonoDevelop.Projects.TargetEvaluationResult", null); + CallContext.SetData ("MonoDevelop.Projects.ProjectOperationContext", currentContext); + CallContext.SetData ("MonoDevelop.Projects.TargetEvaluationResult", currentResult); } } @@ -102,6 +104,7 @@ namespace MonoDevelop.Projects newContext = new TargetEvaluationContext (); else if (!(newContext is TargetEvaluationContext)) newContext = new TargetEvaluationContext (newContext); + var res = OnRunTarget (monitor, target, configuration, (TargetEvaluationContext) newContext); CallContext.SetData ("MonoDevelop.Projects.TargetEvaluationResult", res); return res.BuildResult; @@ -119,13 +122,20 @@ namespace MonoDevelop.Projects internal protected virtual TargetEvaluationResult OnRunTarget (IProgressMonitor monitor, string target, ConfigurationSelector configuration, TargetEvaluationContext context) { - var r = base.OnRunTarget (monitor, target, configuration); - var evalRes = CallContext.GetData ("MonoDevelop.Projects.TargetEvaluationResult") as TargetEvaluationResult; - if (evalRes != null) - evalRes.BuildResult = r; - else - evalRes = new TargetEvaluationResult (r); - return evalRes; + var currentContext = CallContext.GetData ("MonoDevelop.Projects.ProjectOperationContext") as ProjectOperationContext; + CallContext.SetData ("MonoDevelop.Projects.ProjectOperationContext", context); + + try { + var r = base.OnRunTarget (monitor, target, configuration); + var evalRes = CallContext.GetData ("MonoDevelop.Projects.TargetEvaluationResult") as TargetEvaluationResult; + if (evalRes != null) + evalRes.BuildResult = r; + else + evalRes = new TargetEvaluationResult (r); + return evalRes; + } finally { + CallContext.SetData ("MonoDevelop.Projects.ProjectOperationContext", currentContext); + } } string[] supportedMSBuildTargets; diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs index 5032124097..a06690fdca 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs @@ -89,7 +89,6 @@ namespace MonoDevelop.Projects } } - public string Name { get { return filename; } @@ -470,7 +469,7 @@ namespace MonoDevelop.Projects } } - internal class ProjectFileVirtualPathChangedEventArgs : EventArgs + class ProjectFileVirtualPathChangedEventArgs : EventArgs { public ProjectFileVirtualPathChangedEventArgs (ProjectFile projectFile, FilePath oldPath, FilePath newPath) { @@ -484,7 +483,7 @@ namespace MonoDevelop.Projects public FilePath NewVirtualPath { get; private set; } } - internal class ProjectFilePathChangedEventArgs : ProjectFileVirtualPathChangedEventArgs + class ProjectFilePathChangedEventArgs : ProjectFileVirtualPathChangedEventArgs { public ProjectFilePathChangedEventArgs (ProjectFile projectFile, FilePath oldPath, FilePath newPath, FilePath oldVirtualPath, FilePath newVirtualPath) : base (projectFile, oldVirtualPath, newVirtualPath) { diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs index cadf15d78c..ab4ca63590 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs @@ -375,9 +375,10 @@ namespace MonoDevelop.Projects obj.ConvertToFormat (format, true); obj.Save (monitor);
List<FilePath> newFiles = obj.GetItemFiles (true); - + var resolvedTargetPath = new FilePath (targetPath).ResolveLinks ().FullPath; + foreach (FilePath f in newFiles) { - if (!f.IsChildPathOf (targetPath)) { + if (!f.IsChildPathOf (resolvedTargetPath)) { if (obj is Solution) monitor.ReportError ("The solution '" + obj.Name + "' is referencing the file '" + f.FileName + "' which is located outside the root solution directory.", null); else diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs index fc9ee9731a..5b8217ddfa 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs @@ -180,7 +180,6 @@ namespace MonoDevelop.Projects } // Used by serialization only - [ProjectPathItemProperty ("StartupItem", DefaultValue=null, ReadOnly=true)] internal string StartupItemFileName { get { if (SingleStartup && StartupItem != null) @@ -191,8 +190,6 @@ namespace MonoDevelop.Projects set { startItemFileName = value; } } - [ItemProperty ("StartupItems", ReadOnly=true)] - [ProjectPathItemProperty ("Item", Scope="*")] internal List<string> MultiStartupItemFileNames { get { if (SingleStartup) |