You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to see previewer for Views in class library #207
So I have a class library with some views. Its part of a plugin based application I am developing, since this library is not referenced from the main UI as it gets loaded during runtime, is there a way to make the previewer work for my plugins without having to reference the class library from the main project?
To Reproduce
Add a class library without referencing from the desktop project, create some views, build the project and open the designer.
changed the title [-][Bug]: Unable to see previewer for Views in class library[/-][+]Unable to see previewer for Views in class library[/+]on Oct 8, 2026
In short, we can only preview XAML file, when we have Application context, with defined themes/styles.
Most often, BuildAvaloniaApp is used as an entry point, but since recently we also allow any App.axaml project to be used as a previewing target, even libraries. For example, xplat shared project with application and defined themes/fonts.
And we resolve list of potential target project, by analyzing transitive references to the XAML project. Which doesn't work in your specific case - plugin project is not referenced statically.
We can't relibly support previewing arbitrary XAML libraries, without any theme context (in Avalonia, themes must be imported explicitly on a Application).
But to solve your specific problem, we could add some sort of a hint on which project to use for preview. Or, add a extension setting to display all projects as potential targets, without filtering by static references.
@waliarubal As @maxkatz6 has pointed out, a preview isn't currently shown for scenarios like this because we don't know which themes and styles to use. It's hard to create a visual representation of what something should look like when key visual characteristics aren't defined.
What were you expecting would/should happen in this scenario:
The previewer finds the only project in the solution that could be used and uses that?
You could choose to use an application from the solution (if there were multiple) as the basis for the preview?
The preview be rendered with the themes and styles you would get in a new project?
The preview be rendered with no theme or styles applied?
@mrlacey and @maxkatz6 I was expecting that dropdown on top right of the designer which allows selection of desktop project as previewer target to appear and I could in my case select the main desktop project (despite of it having no direct reference of plugin project. In your words I could choose to use an application from the solution (if there were multiple) as the basis for the preview.
@maxkatz6 and @mrlacey do let me know when this feature request be incorporated in your release? Kind of curious but do you guys have a roadmap where we can know what and when new stuff is coming out? Not just for avalonia but also for your Visual Studio other IDE extensions. Thanks!
When the version with this feature is released, we will update this issue.
We do not have public roadmaps for the extensions.
The intention for each release is that they include new features as well as bug fixes.
New releases come out when ready, and this is roughly every 4-6 weeks.
Thanks, @mrlacey, for the reply. It would be great if Avalonia could consider having a public roadmap for its products and extensions. This would help users understand what features are being planned and make it easier to decide when and how to adopt them.
There are pros and cons to public roadmaps.
We're not planning on changing our position on this, but if there are features you need that are stopping you from adopting the platform or tooling, it's in everyone's interest if you let us know what you need, rather than waiting in the hope it will appear on a roadmap.
Activity
[-][Bug]: Unable to see previewer for Views in class library[/-][+]Unable to see previewer for Views in class library[/+]maxkatz6 commentedon Oct 8, 2026
That's an expected limitations of Avalonia, we currently have.
The preview screen also explains what possible workaround you have.
maxkatz6 commentedon Oct 8, 2026
In short, we can only preview XAML file, when we have
Applicationcontext, with defined themes/styles.Most often,
BuildAvaloniaAppis used as an entry point, but since recently we also allow anyApp.axamlproject to be used as a previewing target, even libraries. For example, xplat shared project with application and defined themes/fonts.And we resolve list of potential target project, by analyzing transitive references to the XAML project. Which doesn't work in your specific case - plugin project is not referenced statically.
maxkatz6 commentedon Oct 8, 2026
We can't relibly support previewing arbitrary XAML libraries, without any theme context (in Avalonia, themes must be imported explicitly on a Application).
But to solve your specific problem, we could add some sort of a hint on which project to use for preview. Or, add a extension setting to display all projects as potential targets, without filtering by static references.
mrlacey commentedon Oct 8, 2026
@waliarubal As @maxkatz6 has pointed out, a preview isn't currently shown for scenarios like this because we don't know which themes and styles to use. It's hard to create a visual representation of what something should look like when key visual characteristics aren't defined.
What were you expecting would/should happen in this scenario:
waliarubal commentedon Oct 8, 2026
@mrlacey and @maxkatz6 I was expecting that dropdown on top right of the designer which allows selection of desktop project as previewer target to appear and I could in my case select the main desktop project (despite of it having no direct reference of plugin project. In your words I could choose to use an application from the solution (if there were multiple) as the basis for the preview.
waliarubal commentedon Oct 9, 2026
@maxkatz6 and @mrlacey do let me know when this feature request be incorporated in your release? Kind of curious but do you guys have a roadmap where we can know what and when new stuff is coming out? Not just for avalonia but also for your Visual Studio other IDE extensions. Thanks!
mrlacey commentedon Oct 12, 2026
When the version with this feature is released, we will update this issue.
We do not have public roadmaps for the extensions.
The intention for each release is that they include new features as well as bug fixes.
New releases come out when ready, and this is roughly every 4-6 weeks.
waliarubal commentedon Oct 12, 2026
Thanks, @mrlacey, for the reply. It would be great if Avalonia could consider having a public roadmap for its products and extensions. This would help users understand what features are being planned and make it easier to decide when and how to adopt them.
mrlacey commentedon Oct 13, 2026
There are pros and cons to public roadmaps.
We're not planning on changing our position on this, but if there are features you need that are stopping you from adopting the platform or tooling, it's in everyone's interest if you let us know what you need, rather than waiting in the hope it will appear on a roadmap.