question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When building a Net5 control library, the default template is not being applied

See original GitHub issue

Describe 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

  1. Unzip the repro: MyControls.zip
  2. Set the package project as startup.
  3. Run the application.
  4. Observe that OnApplyTemplate in \MyControls\MyTemplatedControl.cs isn’t hit.
  5. 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:closed
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
billhenncommented, Mar 9, 2021

Wow this is a frustrating one. I just ran into it myself. Sure hope this is fixed ASAP.

1reaction
azchohficommented, Mar 9, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found