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.

WPF SDK feedback - netfx/corefx multitargeting

See original GitHub issue

I built a proof of concept for sharing code between Desktop and Core versions of WPF: wpfpoc

The repository is at https://github.com/gulbanana/wpf-multitarget. It works well enough to be very encouraging; here are some gotchas I ran into along the way.

  • The SDK doesn’t contain a glob for Page items, nor does it nest them using DependentUpon.

  • Building in visual studio sometimes takes a couple of tries. in particular the first clean rebuild seems to fail. This seems related to the generated xaml project.

  • When importing the props and targets, netfx must not use Microsoft.NET.Sdk.Wpf, because it already has winfx.targets coming from Microsoft.NET.Sdk. However, corefx needs the WPF targets imported after the core sdk targets. this means we can’t use Project Sdk= but must instead decompose the sdk into hand-written imports.

  • Error messages are poor; in particular, failures to load xaml will be reported at runtime as a ArgumentNullException failing to format an error. Here’s an incomprehensible stack trace which really meant “you have failed to declare an xmlns in a resource dictionary”: xaml-load-failure

  • dotnet build cannot be used yet, presumably due to the dependency on Microsoft.WinFX.targets. I’m sure this one is a known issue, but it’s irritating… yet useful for multi-targetting compatibility. Can we make sure that multitargeting remains possible when this is somehow fixed? 😃

  • The lack of a Properties.cs in .net core projects - for the most part a good thing - means that there’s no obvious place to put the ThemeInfo attribute required for control xaml discovery.

  • You basically have to be a WPF expert to discover most of this. Sharing code between legacy netfx and new corefx apps is going to be a major use case, so it could really use templates and polish. At the moment, if you fall slightly off the interop path then you get upsettting msbuild errors (“required targets are missing” and everything unloads itself) or upsetting runtime errors (“load failure in something xaml did somewhere”).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
nguerreracommented, Feb 23, 2019

I believe all of the feedback has been addressed at this point. Let me know if I’m missing something and we can reopen.

1reaction
gulbananacommented, Feb 27, 2019

Everything’s working well in the builds I’ve tested.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WPF SDK feedback - netfx/corefx multitargeting · Issue #88
I built a proof of concept for sharing code between Desktop and Core versions of WPF: The repository is at ...
Read more >
Support multiple .NET Framework versions in your project file
This article shows you how to do that for SDK-style projects. For SDK-style projects, you can configure support for multiple targets frameworks ...
Read more >
Target frameworks in SDK-style projects - .NET
When you target a framework in an app or library, you're specifying the set of APIs that you'd like to make available to...
Read more >
How to Multi target a library project with WPF controls
I would like to take advantage of the new csproj format that has come out with .NET Core projects because multitargeting is much...
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