Search code examples
c#uwpresourcedictionary

Build action for resource dictionary in UWP


What should the build action for a resource dictionary? In WPF it's Resource build action for ResourceDictionary file, but in UWP there no such a build action, and googling didn't help so far.

I tried several options like Embedded Resource and so on but all of them just cause different exceptions.

The project works without using the ResourceDictionary file and there is just one simple style in it.


Solution

  • For ResourceDictionary the setup should look as in this screenshot:

    Resource dictionary properties

    So the Build Action is Page and the Custom Tool should be XamlIntelliSenseFileGenerator.

    If you are still getting an exception, ensure that the XAML code is valid or alternatively right-click a folder in your project, select Add > Add new item..., select XAML category on the left and then Resource Dictionary template and let Visual Studio create the correct file for you.