Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit df292ae

Browse files
committed
When loading a portable library project and the portable library tools are not installed, display an error message directing the user to the download.
1 parent 9993dcd commit df292ae

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
// DEALINGS IN THE SOFTWARE.
1818

1919
using System;
20-
using System.Collections;
21-
using System.Collections.Generic;
22-
using System.IO;
2320
using ICSharpCode.Core;
2421
using ICSharpCode.SharpDevelop.Gui;
2522

@@ -30,15 +27,22 @@ namespace ICSharpCode.SharpDevelop.Project.PortableLibrary
3027
/// </summary>
3128
public class CheckPortableLibraryInstalled : AbstractCommand
3229
{
30+
public static string CouldNotFindToolsDescription {
31+
get {
32+
return StringParser.Parse(
33+
"${res:PortableLibrary.CouldNotFindTools}" + Environment.NewLine + Environment.NewLine
34+
+ "${res:PortableLibrary.ToolsInstallationHelp}");
35+
}
36+
}
37+
38+
public static string DownloadUrl {
39+
get { return "http://go.microsoft.com/fwlink/?LinkId=210823"; }
40+
}
41+
3342
public override void Run()
3443
{
3544
if (!ProfileList.IsPortableLibraryInstalled()) {
36-
using (ToolNotFoundDialog dlg = new ToolNotFoundDialog(
37-
StringParser.Parse(
38-
"${res:PortableLibrary.CouldNotFindTools}" + Environment.NewLine + Environment.NewLine +
39-
"${res:PortableLibrary.ToolsInstallationHelp}"),
40-
"http://go.microsoft.com/fwlink/?LinkId=210823"
41-
)) {
45+
using (ToolNotFoundDialog dlg = new ToolNotFoundDialog(CouldNotFindToolsDescription, DownloadUrl)) {
4246
// our message is long, so make the window bigger than usual
4347
dlg.Width += 70;
4448
dlg.Height += 70;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
using Microsoft.Build.Construction;
3535
using Microsoft.Build.Evaluation;
3636
using Microsoft.Build.Exceptions;
37+
using ICSharpCode.SharpDevelop.Project.PortableLibrary;
3738
using MSBuild = Microsoft.Build.Evaluation;
3839

3940
namespace ICSharpCode.SharpDevelop.Project
@@ -1243,6 +1244,11 @@ public MSBuildBasedProject(ProjectLoadInformation loadInformation)
12431244
} else {
12441245
throw;
12451246
}
1247+
} else if (ex.ErrorCode == "MSB4019" && ex.BaseMessage.Contains("Microsoft.Portable.") && !ProfileList.IsPortableLibraryInstalled()) {
1248+
throw new ToolNotFoundProjectLoadException(ex.Message, ex) {
1249+
Description = CheckPortableLibraryInstalled.CouldNotFindToolsDescription,
1250+
LinkTarget = CheckPortableLibraryInstalled.DownloadUrl
1251+
};
12461252
} else {
12471253
throw;
12481254
}

0 commit comments

Comments
 (0)