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

Commit d743b69

Browse files
KirillOsenkovmonojenkins
authored andcommitted
Fixes to WithDynamicDocuments()
1 parent bc73132 commit d743b69

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/DynamicFileManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public ProjectInfo UpdateDynamicFiles (ProjectInfo projectInfo, IEnumerable<stri
141141
}
142142
}
143143

144-
projectInfo = projectInfo.WithAdditionalDocuments(documents);
144+
projectInfo = projectInfo.WithDocuments(projectInfo.Documents.Concat(documents));
145145
return projectInfo;
146146
}
147147
}

main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,11 +1532,26 @@ void OnProjectModified (object sender, MonoDevelop.Projects.SolutionItemModified
15321532

15331533
internal ProjectInfo WithDynamicDocuments (MonoDevelop.Projects.Project project, ProjectInfo projectInfo)
15341534
{
1535+
var projectDirectory = Path.GetDirectoryName (project.FileName);
1536+
15351537
var contentItems = project.MSBuildProject.EvaluatedItems
15361538
.Where (item => item.Name == "Content" && item.Include.EndsWith (".razor", StringComparison.OrdinalIgnoreCase))
1537-
.Select (item => item.Include);
1539+
.Select (item => GetAbsolutePath(item.Include))
1540+
.ToList ();
15381541

15391542
return dynamicFileManager?.UpdateDynamicFiles (projectInfo, contentItems, this);
1543+
1544+
string GetAbsolutePath (string relativePath)
1545+
{
1546+
if (!Path.IsPathRooted (relativePath)) {
1547+
relativePath = Path.Combine (projectDirectory, relativePath);
1548+
}
1549+
1550+
// normalize the path separator characters in case they're mixed
1551+
relativePath = relativePath.Replace ('\\', Path.DirectorySeparatorChar);
1552+
1553+
return relativePath;
1554+
}
15401555
}
15411556

15421557
internal override void SetDocumentContext (DocumentId documentId)

0 commit comments

Comments
 (0)