Browse Source

Fixed SD2-1550 - Exception creating new F# project when F# compiler is not installed

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4534 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
f5c68e18cd
  1. 6
      src/AddIns/BackendBindings/FSharp/FSharpBinding/Project/Src/project.fs
  2. 8
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs

6
src/AddIns/BackendBindings/FSharp/FSharpBinding/Project/Src/project.fs

@ -38,7 +38,11 @@ type FSharpProject = class
new (info : ProjectCreateInformation) as x = new (info : ProjectCreateInformation) as x =
{ inherit CompilableProject(info.Solution) } then { inherit CompilableProject(info.Solution) } then
x.Create(info) x.Create(info)
base.AddImport(@"$(MSBuildExtensionsPath)\FSharp\1.0\Microsoft.FSharp.Targets", null) try
base.AddImport(@"$(MSBuildExtensionsPath)\FSharp\1.0\Microsoft.FSharp.Targets", null)
with
| :? Microsoft.Build.BuildEngine.InvalidProjectFileException as ex ->
raise (ProjectLoadException("Please ensure that the F# compiler is installed on your computer.\n\n" + ex.Message, ex))
override x.GetDefaultItemType(fileName : string) = override x.GetDefaultItemType(fileName : string) =
if String.Equals(".fs", Path.GetExtension(fileName), StringComparison.InvariantCultureIgnoreCase) then if String.Equals(".fs", Path.GetExtension(fileName), StringComparison.InvariantCultureIgnoreCase) then
ItemType.Compile ItemType.Compile

8
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs

@ -304,7 +304,13 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
StringParser.Properties["StandardNamespace"] = projectCreateInformation.RootNamespace; StringParser.Properties["StandardNamespace"] = projectCreateInformation.RootNamespace;
IProject project = languageinfo.CreateProject(projectCreateInformation); IProject project;
try {
project = languageinfo.CreateProject(projectCreateInformation);
} catch (ProjectLoadException ex) {
MessageService.ShowError(ex.Message);
return null;
}
// Add Project items // Add Project items
foreach (ProjectItem projectItem in projectItems) { foreach (ProjectItem projectItem in projectItems) {

Loading…
Cancel
Save