When building a Net5 control library, the default template is not being applied
See original GitHub issueDescribe the bug I have a class library with a custom control that has a generic.xaml template. The template defined in the class library doesn’t get applied, but you have to re-apply it in the application as well.
Steps to reproduce the bug
- Unzip the repro: MyControls.zip
- Set the package project as startup.
- Run the application.
- Observe that
OnApplyTemplate
in\MyControls\MyTemplatedControl.cs
isn’t hit. - Manually define a control template in app.xaml and observe that it is now hit, demonstrating that the template defined in Generic.xaml isn’t working.
Note: This might be an artifact or related to #4453
Expected behavior Control template defined in the class library works (this works if the target is UWP).
Version Info NuGet package version: [Microsoft.WinUI 3.0.0-preview4.210210.4] Visual Studio 16.9.0 (I’m fairly certain it worked in the last preview of Update 9)
Windows app type:
UWP | Win32 |
---|---|
No | Yes |
Windows 10 version | Saw the problem? |
---|---|
Insider Build (xxxxx) | |
October 2020 Update (19042) | |
May 2020 Update (19041) | |
November 2019 Update (18363) | |
May 2019 Update (18362) | |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | |
Xbox | |
Surface Hub | |
IoT |
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
NET default templates for dotnet new - .NET CLI
The following table shows the templates that come pre-installed with the .NET SDK. The default language for the template is shown inside the ......
Read more >Packing a control library puts generic.xbf in the wrong folder
When I'm packing a control class library with a generic.xaml file, ... When building a Net5 control library, the default template is not...
Read more >WPF Custom Control Template Not Applied
Try this: Set Build Action to BasicTemplate.xaml to Page. Add reference to BasicTemplate.xaml in Generic.xaml:.
Read more >Problem with default template arguments with /std::c++latest
I recently tried recompiling a project that was last built on 30-October-2020 using the most recent general release version of Visual Studio 2019...
Read more >How to Create Your .NET Project Template
NET developer, you have many built-in templates to start a new project or add a new item to an existing project, including console...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wow this is a frustrating one. I just ran into it myself. Sure hope this is fixed ASAP.
I believe this might be a regression on 16.9 stable? I started seeing the same issue on my machine today. I will investigate further tomorrow.