Skip to content

Unable to see previewer for Views in class library #207

Description

@waliarubal

Describe the bug

Image 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.

Product(s)

Avalonia for Visual Studio

Platform

Windows

License Tier

Community

Avalonia version

12.1.3

Tool/Control Version

12.3.2

Relevant log output

Additional context

No response

Activity

  1. added theissue type on Oct 7, 2026
  2. removed theissue type on Oct 8, 2026
  3. 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
  4. maxkatz6 commented on Oct 8, 2026

    @maxkatz6
    Member

    That's an expected limitations of Avalonia, we currently have.
    The preview screen also explains what possible workaround you have.

  5. maxkatz6 commented on Oct 8, 2026

    @maxkatz6
    Member

    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.

  6. maxkatz6 commented on Oct 8, 2026

    @maxkatz6
    Member

    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.

  7. self-assigned this
    on Oct 8, 2026
  8. mrlacey commented on Oct 8, 2026

    @mrlacey
    Contributor

    @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?
    • Something else? If so, what?
  9. waliarubal commented on Oct 8, 2026

    @waliarubal
    Author

    @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.

    Image
  10. waliarubal commented on Oct 9, 2026

    @waliarubal
    Author

    @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!

  11. mrlacey commented on Oct 12, 2026

    @mrlacey
    Contributor

    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.

  12. waliarubal commented on Oct 12, 2026

    @waliarubal
    Author

    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.

  13. mrlacey commented on Oct 13, 2026

    @mrlacey
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions