Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
<TargetFramework>net5.0-windows10.0.19041</TargetFramework>
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
```

- Use the [C#/WinRT](/windows/uwp/csharp-winrt/) tool chain to generate or customize WinRT APIs and types for .NET 5 and later versions.
Expand Down
27 changes: 27 additions & 0 deletions docs/core/tools/sdk-errors/netsdk1130.md
Original file line number Diff line number Diff line change
@@ -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:

> *\<Component name>* 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
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
```

* 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) and [Call Windows Runtime APIs in desktop apps](/windows/apps/desktop/modernize/desktop-to-uwp-enhance).
4 changes: 2 additions & 2 deletions docs/core/tools/sdk-errors/netsdk1149.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:

Expand Down
2 changes: 2 additions & 0 deletions docs/fundamentals/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down