From 9ea77ce86004c803cabe206b4db4ce7be819da41 Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Tue, 29 Jun 2021 13:05:54 -0700 Subject: [PATCH 1/4] draft --- docs/core/tools/sdk-errors/netsdk1130.md | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 docs/core/tools/sdk-errors/netsdk1130.md diff --git a/docs/core/tools/sdk-errors/netsdk1130.md b/docs/core/tools/sdk-errors/netsdk1130.md new file mode 100644 index 0000000000000..952aaf2817998 --- /dev/null +++ b/docs/core/tools/sdk-errors/netsdk1130.md @@ -0,0 +1,27 @@ +--- +title: "NETSDK1130: Can't reference a Windows Metadata component directly" +description: How to resolve the issue of not being able to reference a Windows Metadata component directly from an app that targets .NET 5 or later. +author: tdykstra +ms.author: tdykstra +ms.topic: error-reference +ms.date: 06/29/2021 +f1_keywords: +- NETSDK1130 +--- +# NETSDK1130: Can't reference a Windows Metadata component directly + +NETSDK1130 indicates that you're trying to reference a Windows Metadata component directly from an app that targets .NET 5 or later. The full error message is similar to the following example: + +> *\* cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. + +To resolve this error: + +* Remove references to the [Microsoft.Windows.SDK.Contracts package](https://www.nuget.org/packages/Microsoft.Windows.SDK.Contracts). Instead, specify the version of the Windows APIs that you want to access via the `TargetFramework` property of the project. For example: + + ```xml + net5.0-windows10.0.19041 + ``` + +* Use the [C#/WinRT](/windows/uwp/csharp-winrt/) tool chain to generate or customize WinRT APIs and types for .NET 5 and later versions. + +For more information, see [Built-in support for WinRT is removed from .NET](../../compatibility/interop/5.0/built-in-support-for-winrt-removed.md). From 767c6ff05c4ee6fb0841b550d8be873b3cfa5a7c Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Tue, 29 Jun 2021 13:09:02 -0700 Subject: [PATCH 2/4] expand 5+ --- docs/core/tools/sdk-errors/netsdk1149.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/tools/sdk-errors/netsdk1149.md b/docs/core/tools/sdk-errors/netsdk1149.md index 42fda5588dc83..65a59e650ff1a 100644 --- a/docs/core/tools/sdk-errors/netsdk1149.md +++ b/docs/core/tools/sdk-errors/netsdk1149.md @@ -1,5 +1,5 @@ --- -title: "NETSDK1149: Built-in WinRT support not provided in .NET 5+" +title: "NETSDK1149: Built-in WinRT support not provided in .NET 5 and later" description: How to reference a component with built-in WinRT support from an app that targets .NET 5 or later. author: tdykstra ms.author: tdykstra @@ -8,7 +8,7 @@ ms.date: 06/28/2021 f1_keywords: - NETSDK1149 --- -# NETSDK1149: Built-in WinRT support not provided in .NET 5+" +# NETSDK1149: Built-in WinRT support not provided in .NET 5 and later NETSDK1149 indicates that you're trying to reference a component that requires WinRT in an application that targets .NET 5 or a later version. These .NET versions don't have built-in support for WinRT. The full error message is similar to the following example: From 6af780bd95107e9da3cc3a02f59747c9987202f9 Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Tue, 29 Jun 2021 13:11:03 -0700 Subject: [PATCH 3/4] add to toc --- docs/fundamentals/toc.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/fundamentals/toc.yml b/docs/fundamentals/toc.yml index bc301fb9b790b..d7a1c27e4ee10 100644 --- a/docs/fundamentals/toc.yml +++ b/docs/fundamentals/toc.yml @@ -204,6 +204,8 @@ items: href: ../core/tools/sdk-errors/netsdk1079.md - name: NETSDK1080 href: ../core/tools/sdk-errors/netsdk1080.md + - name: NETSDK1130 + href: ../core/tools/sdk-errors/netsdk1130.md - name: NETSDK1141 href: ../core/tools/sdk-errors/netsdk1141.md - name: NETSDK1145 From 7b03b1d697b55bd6632a707c429b39bfa718cf8e Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Wed, 30 Jun 2021 09:29:00 -0700 Subject: [PATCH 4/4] address feedback --- .../interop/5.0/built-in-support-for-winrt-removed.md | 2 +- docs/core/tools/sdk-errors/netsdk1130.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/core/compatibility/interop/5.0/built-in-support-for-winrt-removed.md b/docs/core/compatibility/interop/5.0/built-in-support-for-winrt-removed.md index 17aa042395f5c..b188e028ab13f 100644 --- a/docs/core/compatibility/interop/5.0/built-in-support-for-winrt-removed.md +++ b/docs/core/compatibility/interop/5.0/built-in-support-for-winrt-removed.md @@ -29,7 +29,7 @@ This breaking change was made for the following reasons: - Remove references to the [Microsoft.Windows.SDK.Contracts package](https://www.nuget.org/packages/Microsoft.Windows.SDK.Contracts). Instead, specify the version of the Windows APIs that you want to access via the `TargetFramework` property of the project. For example: ```xml - net5.0-windows10.0.19041 + net5.0-windows10.0.19041.0 ``` - Use the [C#/WinRT](/windows/uwp/csharp-winrt/) tool chain to generate or customize WinRT APIs and types for .NET 5 and later versions. diff --git a/docs/core/tools/sdk-errors/netsdk1130.md b/docs/core/tools/sdk-errors/netsdk1130.md index 952aaf2817998..a3be174ca91a6 100644 --- a/docs/core/tools/sdk-errors/netsdk1130.md +++ b/docs/core/tools/sdk-errors/netsdk1130.md @@ -19,9 +19,9 @@ To resolve this error: * Remove references to the [Microsoft.Windows.SDK.Contracts package](https://www.nuget.org/packages/Microsoft.Windows.SDK.Contracts). Instead, specify the version of the Windows APIs that you want to access via the `TargetFramework` property of the project. For example: ```xml - net5.0-windows10.0.19041 + net5.0-windows10.0.19041.0 ``` * Use the [C#/WinRT](/windows/uwp/csharp-winrt/) tool chain to generate or customize WinRT APIs and types for .NET 5 and later versions. -For more information, see [Built-in support for WinRT is removed from .NET](../../compatibility/interop/5.0/built-in-support-for-winrt-removed.md). +For more information, see [Built-in support for WinRT is removed from .NET](../../compatibility/interop/5.0/built-in-support-for-winrt-removed.md) and [Call Windows Runtime APIs in desktop apps](/windows/apps/desktop/modernize/desktop-to-uwp-enhance).