Skip to content

Using net5.0-windows10.* target framework results in typeconflicts. #3579

@trympet

Description

@trympet

Describe the bug

A clear and concise description of what the bug is.
Targeting a windows-specific TFM in .NET 5, results in type conflicts between the UWP APIs in Microsoft.Windows.SDk.Contracts and the .NET SDK.

The following errors are observed in Visual Studio:

Error	NETSDK1130	Referencing a Windows Metadata component directly when targeting .NETCoreApp,Version=v5.0 is not supported. Use the C#/WinRT projection tool (https://aka.ms/cswinrt) or a provided projection for this target
Error	CS0433	The type 'XmlDocument' exists in both 'Microsoft.Windows.SDK.NET, Version=10.0.17763.10, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'
  • Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

  • Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)
  1. Create a .NET class library project
  2. Change the target framework moniker to net5.0-windows10.0.17763.0
  3. Add a reference to Microsoft.Toolkit.Uwp.Notifications.
  4. Reference any of the following types:
    Windows.UI.Notifications.TileNotification, Windows.Data.Xml.Dom.XmlDocument.
    Example:
  5. Build project

Expected behavior

A successful build with no type conflicts or compiler errors.

Screenshots

If applicable, add screenshots to help explain your problem.
image
image

Environment

Any windows-specific TFM.
NuGet Package(s): Microsoft.Toolkit.Uwp.Notifications

Package Version(s): 7.0.0-preview4, 6.1.1

Runtime: 5.0.100
OS build: 10.0.19041

App min and target version:

  • Fall Creators Update (16299)
  • April 2018 Update (17134)
  • October 2018 Update (17763)
  • May 2019 Update (18362)
  • May 2020 Update (19041)
  • Insider Build (xxxxx)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Completed 🔥bug 🐛An unexpected issue that highlights incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions