Skip to content

Build Tools Issue with Templated Controls #10540

@StevoSM

Description

@StevoSM

Describe the bug

When creating a custom control using the ResourceDictionary approach, the build tools will generate the expected files, but the *.xaml.g.h file is empty.

As pasted below, the *.g.h file contains

#if defined(WINRT_FORCE_INCLUDE_SAMPLERESOURCEDICTIONARY_XAML_G_H) || __has_include("SampleResourceDictionary.xaml.g.h")

#include "SampleResourceDictionary.xaml.g.h"

#else

namespace winrt::Win2DSandbox::implementation
{
    template <typename D, typename... I>
    using SampleResourceDictionaryT = SampleResourceDictionary_base<D, I...>;
}

#endif

If SampleResourceDictionary.xaml.g.h cannot be found in the include paths, then the basic declaration is used, which for ResourceDictionary-based controls is often enough. However, if SampleResourceDictionary.xaml.g.h ends up in the include paths, because it is empty, it doesn't contain the declaration which results in loads of compile errors.

I would expect the SampleResourceDictionary.xaml.g.h would at least contain the basic declaration but also any additional content as needed.

The attached solution demonstrates the issue. As configured, the $(GeneratedFilesDir)ResourceDictionary directory is in the include paths which triggers all the compile errors. The solution should be configured to reference the needed packages but they are not included in the ZIP.
Win2DSandbox.zip

Steps to reproduce the bug

Open the attached solution and ensure packages are installed.
Build.

Expected behavior

No response

Screenshots

No response

NuGet package version

None

Windows version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions