Build Tools Issue with Templated Controls
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
Hi @StevoSM , with the repro project Win2DSandbox.zip we are facing lots of compile time error, can you please recheck?
@snigdha011997 What are the compile time errors you are seeing? It's likely that those compile time errors are demonstrating the exact issue. If the generated SampleResourceDictionary.xaml.g.h is included in the build, you will get compile errors which are unresolvable. That file should not be empty.