Allow Razor files to appear in any source item type#7417
Allow Razor files to appear in any source item type#7417drewnoakes merged 11 commits intodotnet:mainfrom
Conversation
| } | ||
|
|
||
| public void Handle(IComparable version, IProjectChangeDescription projectChange, ContextState state, IProjectDiagnosticOutputService logger) | ||
| public void Handle(IComparable version, IImmutableDictionary<string, IProjectChangeDescription> projectChanges, ContextState state, IProjectDiagnosticOutputService logger) |
There was a problem hiding this comment.
Recommend reviewing this file with whitespace turned off, otherwise GitHub overplays the changes.
|
Looks good. As discussed separately, this may add Razor files to intellisense which are not present in the build. It seems like it would be safer to have a property that controls which item types are considered dynamic. This could be added here I think, with a small tweak to your new ISourceItemHandler interface to also take ConfigurationGeneral, sync-linked to the items it receives today, then pulling from the required item type(s) alone. |
|
And verified in Project System Tools when dumping the Roslyn workspace that all of the right files are there. I think this is good to go from my point of view.
For the Razor editor this is actually a good thing. Firstly it matches the experience of using the old editor, which is the main concern we have (we don't want users to notice that anything is different in VS 2022 with the new editor), and its also something I think we are happy with, with respect to lighting up the editor in any circumstances. If that changes in future we can always update. |
...ctSystem/LanguageServices/WorkspaceProjectContextHost.WorkspaceProjectContextHostInstance.cs
Outdated
Show resolved
Hide resolved
|
Not sure how you'll feel about the last couple of commits here.. but I thought it beat duplicating all those methods to handle a 2-tuple. If a larger refactoring is desired, you can always do it when you fix the evaluation bit 😛 |
|
@dotnet/project-system can I get reviews on this? would love to get this in to preview 3 so Bing can test it etc. |
|
Thanks Drew! |

Fixes #7411
Fixes dotnet/aspnetcore#34188
This changes the DynamicItemHandler for Razor so that instead of being hardcoded to the
Contentitem type, it now uses CPSes SourceItemsService (via an ISourceItemsHandler) so that it can see all items in any type that is considered a source file. Essentially my understanding is that this will now see any file that is in the project tree. This solves various issues from enterprise solutions:EmbeddedResourceitem typeNoneitem type (ie, the default from the SDK) and uses custom build targets and tasks to process them at build timeAvailableItemNameI'm still doing manual validation, but want to get a real build so may as well put this up too.
Microsoft Reviewers: Open in CodeFlow