Exporting resource dictionaries from a library RRS feed

  • Question

  • I followed the discussion


    about using resource libraries embedded in a library, but it doesn;t seem to work.

    No matters whether "Generate library layout" (now you can set it in Visual Studio by ticking "Generate Library Layout" checkbox in Properties/Build for the library) is enabled or disabled, the output doesn't go to main project, but to the library folders. As a result, I get message "An error occured by finding a resource library" while trying to include xaml into MergedDictionaries for App.xaml of the main project, and though the compilation succeeds, the application crashes straight after splash screen.

    Sunday, October 4, 2015 11:05 PM


  • Hello pcyanide,

    Welcome to the MSDN forum and I would suggest you could check this guide post to add a proper tag for the thread title to let us understand your problem clearer.

    >>the output doesn't go to main project, but to the library folders.

    Yes, from my side, it is the same. However, I checked you provided link, and people on that thread does not mention it should be ported to the primary project folder. What I think after the “Generate library layout” is checked, it would generate a right layout and put all the resources next to the dll in a folder named with the same name as class library.

    It is not clear how you process the directory in a dll, here I created a sample with the detail steps which could work on my side, you could follow it to see if it works for you:

    1.Create a blank UWP app and add below XAML to the main page:

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <StackPanel VerticalAlignment="Center">

    2.Create a class library and add a directory file, add these content to it:

    <Style TargetType="Button">
            <Setter Property="Height" Value="100"/>
            <Setter Property="Width" Value="300"/>
            <Setter Property="BorderThickness" Value="5" />
            <Setter Property="Foreground" Value="Blue" />
            <Setter Property="BorderBrush" >
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                        <GradientStop Color="Yellow" Offset="0.0" />
                        <GradientStop Color="Red" Offset="0.25" />
                        <GradientStop Color="Blue" Offset="0.75" />
                        <GradientStop Color="LimeGreen" Offset="1.0" />

    3.Build the class library and add a reference to it from the UWP project.

    4.In the app.xaml page, add below code:

            <ResourceDictionary >
                    <ResourceDictionary Source="ms-appx:///ClassLibrary1/Dictionary3.xaml"/>

    5.Run the project and on my side, it shows me a button with a specific style as:

    Please have a try with my steps, if this does not work for you, please feel free to let me know.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Edited by Fred Bao Tuesday, October 6, 2015 4:49 AM
    • Proposed as answer by Fred Bao Monday, October 19, 2015 11:59 AM
    • Marked as answer by Fred Bao Tuesday, October 20, 2015 4:17 AM
    Tuesday, October 6, 2015 4:48 AM