diff --git a/src/Main/Base/Project/Src/Project/Items/ProjectItem.cs b/src/Main/Base/Project/Src/Project/Items/ProjectItem.cs index b843db6b5b..10a412b4d8 100644 --- a/src/Main/Base/Project/Src/Project/Items/ProjectItem.cs +++ b/src/Main/Base/Project/Src/Project/Items/ProjectItem.cs @@ -356,11 +356,16 @@ namespace ICSharpCode.SharpDevelop.Project return this.Clone(); } + /// + /// Gets/Sets the full path of the file represented by "Include". + /// For ProjectItems that are not assigned to any project, the getter returns the value of Include + /// and the setter throws a NotSupportedException. + /// [Browsable(false)] public virtual string FileName { get { if (project == null) { - throw new NotSupportedException("Not supported for items without project."); + return this.Include; } string fileName = this.fileNameCache; if (fileName == null) { diff --git a/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs b/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs index 4a5bd4f4ee..90912ecfb3 100644 --- a/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs +++ b/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs @@ -57,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands string correctFileName = Path.Combine(Path.GetDirectoryName(c.CompilationUnit.FileName), c.Name + Path.GetExtension(c.CompilationUnit.FileName)); if (FileUtility.IsValidFileName(correctFileName) + && Path.IsPathRooted(correctFileName) && !File.Exists(correctFileName)) { if (c.CompilationUnit.Classes.Count == 1) {