Browse Source

When loading a portable library project and the portable library tools are not installed, display an error message directing the user to the download.

pull/478/head
Daniel Grunwald 12 years ago
parent
commit
df292ae920
  1. 22
      src/Main/Base/Project/Project/PortableLibrary/CheckPortableLibraryInstalled.cs
  2. 6
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

22
src/Main/Base/Project/Project/PortableLibrary/CheckPortableLibraryInstalled.cs

@ -17,9 +17,6 @@ @@ -17,9 +17,6 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
@ -30,15 +27,22 @@ namespace ICSharpCode.SharpDevelop.Project.PortableLibrary @@ -30,15 +27,22 @@ namespace ICSharpCode.SharpDevelop.Project.PortableLibrary
/// </summary>
public class CheckPortableLibraryInstalled : AbstractCommand
{
public static string CouldNotFindToolsDescription {
get {
return StringParser.Parse(
"${res:PortableLibrary.CouldNotFindTools}" + Environment.NewLine + Environment.NewLine
+ "${res:PortableLibrary.ToolsInstallationHelp}");
}
}
public static string DownloadUrl {
get { return "http://go.microsoft.com/fwlink/?LinkId=210823"; }
}
public override void Run()
{
if (!ProfileList.IsPortableLibraryInstalled()) {
using (ToolNotFoundDialog dlg = new ToolNotFoundDialog(
StringParser.Parse(
"${res:PortableLibrary.CouldNotFindTools}" + Environment.NewLine + Environment.NewLine +
"${res:PortableLibrary.ToolsInstallationHelp}"),
"http://go.microsoft.com/fwlink/?LinkId=210823"
)) {
using (ToolNotFoundDialog dlg = new ToolNotFoundDialog(CouldNotFindToolsDescription, DownloadUrl)) {
// our message is long, so make the window bigger than usual
dlg.Width += 70;
dlg.Height += 70;

6
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -34,6 +34,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -34,6 +34,7 @@ using ICSharpCode.SharpDevelop.Dom;
using Microsoft.Build.Construction;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Exceptions;
using ICSharpCode.SharpDevelop.Project.PortableLibrary;
using MSBuild = Microsoft.Build.Evaluation;
namespace ICSharpCode.SharpDevelop.Project
@ -1243,6 +1244,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -1243,6 +1244,11 @@ namespace ICSharpCode.SharpDevelop.Project
} else {
throw;
}
} else if (ex.ErrorCode == "MSB4019" && ex.BaseMessage.Contains("Microsoft.Portable.") && !ProfileList.IsPortableLibraryInstalled()) {
throw new ToolNotFoundProjectLoadException(ex.Message, ex) {
Description = CheckPortableLibraryInstalled.CouldNotFindToolsDescription,
LinkTarget = CheckPortableLibraryInstalled.DownloadUrl
};
} else {
throw;
}

Loading…
Cancel
Save