Skip to content

Merge main into live #45543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 27, 2025
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
20 changes: 20 additions & 0 deletions .openpublishing.redirection.core.json
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,10 @@
"source_path_from_root": "/docs/core/docker/publish-as-container.md",
"redirect_url": "/dotnet/core/containers/sdk-publish"
},
{
"source_path_from_root": "/docs/core/testing/unit-testing-fsharp-with-dotnet-test.md",
"redirect_url": "/dotnet/core/testing/unit-testing-fsharp-with-xunit"
},
{
"source_path_from_root": "/docs/core/testing/unit-testing-platform-architecture-capabilities.md",
"redirect_url": "/dotnet/core/testing/microsoft-testing-platform-architecture-capabilities"
Expand Down Expand Up @@ -1445,6 +1449,22 @@
{
"source_path_from_root": "/docs/core/testing/unit-testing-platform-vs-vstest.md",
"redirect_url": "/dotnet/core/testing/microsoft-testing-platform-vs-vstest"
},
{
"source_path_from_root": "/docs/core/testing/unit-testing-published-output.md",
"redirect_url": "/dotnet/core/tools/dotnet-vstest"
},
{
"source_path_from_root": "/docs/core/testing/unit-testing-visual-basic-with-dotnet-test.md",
"redirect_url": "/dotnet/core/testing/unit-testing-visual-basic-with-xunit"
},
{
"source_path_from_root": "/docs/core/testing/unit-testing-with-mstest.md",
"redirect_url": "/dotnet/core/testing/unit-testing-csharp-with-mstest"
},
{
"source_path_from_root": "/docs/core/testing/unit-testing-with-nunit.md",
"redirect_url": "/dotnet/core/testing/unit-testing-csharp-with-nunit"
}
]
}
2 changes: 1 addition & 1 deletion docs/ai/tutorials/snippets/llm-eval/llm-eval.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.3" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.42.0" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.43.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions docs/architecture/maui/unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ Testing models and view models from MVVM applications is identical to testing an

Don't be tempted to make a unit test exercise more than one aspect of the unit's behavior. Doing so leads to tests that are difficult to read and update. It can also lead to confusion when interpreting a failure.

The eShop multi-platform app uses [MSTest](../../core/testing/unit-testing-with-mstest.md) to perform unit testing, which supports two different types of unit tests:
The eShop multi-platform app uses [MSTest](../../core/testing/unit-testing-csharp-with-mstest.md) to perform unit testing, which supports two different types of unit tests:

| Testing Type | Attribute | Description |
|-----------------|--------------|--------------------------------------------------------------|
| TestMethod | `TestMethod` | Defines the actual test method to run. |
| DataSource | `DataSource` | Tests that are only true for a particular set of data. |

The unit tests included with the eShop multi-platform app are TestMethod, so each unit test method is decorated with the `TestMethod` attribute. In addition to MSTest there are several other testing frameworks available including [NUnit](../../core/testing/unit-testing-with-nunit.md) and [xUnit](../../core/testing/unit-testing-with-dotnet-test.md).
The unit tests included with the eShop multi-platform app are TestMethod, so each unit test method is decorated with the `TestMethod` attribute. In addition to MSTest there are several other testing frameworks available including [NUnit](../../core/testing/unit-testing-csharp-with-nunit.md) and [xUnit](../../core/testing/unit-testing-csharp-with-xunit.md).

## Testing asynchronous functionality

Expand Down
2 changes: 1 addition & 1 deletion docs/azure/includes/dotnet-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@
| Microsoft.Azure.Functions.Worker.Grpc | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Grpc/2.0.0) | | |
| Microsoft.Azure.Functions.Worker.ItemTemplates | NuGet [4.0.5051](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates/4.0.5051) | | |
| Microsoft.Azure.Functions.Worker.ProjectTemplates | NuGet [4.0.5051](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ProjectTemplates/4.0.5051) | | |
| Microsoft.Azure.Functions.Worker.Sdk | NuGet [2.0.1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk/2.0.1) | | |
| Microsoft.Azure.Functions.Worker.Sdk | NuGet [2.0.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk/2.0.2) | | |
| Microsoft.Azure.Functions.Worker.Sdk.Analyzers | NuGet [1.2.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Analyzers/1.2.2) | | |
| Microsoft.Azure.Functions.Worker.Sdk.Generators | NuGet [1.3.4](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Generators/1.3.4) | | |
| Microsoft.Azure.WebJobs.CosmosDb.ChangeProcessor | NuGet [1.0.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.CosmosDb.ChangeProcessor/1.0.4) | | |
Expand Down
2 changes: 1 addition & 1 deletion docs/azure/sdk/unit-testing-mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,4 @@ Here's how it works:

* [Dependency injection in .NET](../../core/extensions/dependency-injection.md)
* [Unit testing best practices](../../core/testing/unit-testing-best-practices.md)
* [Unit testing C# in .NET using dotnet test and xUnit](../../core/testing/unit-testing-with-dotnet-test.md)
* [Unit testing C# in .NET using dotnet test and xUnit](../../core/testing/unit-testing-csharp-with-xunit.md)
11 changes: 6 additions & 5 deletions docs/core/compatibility/10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Breaking changes in .NET 10
titleSuffix: ""
description: Navigate to the breaking changes in .NET 10.
ms.date: 01/30/2025
ms.date: 03/25/2025
ai-usage: ai-assisted
no-loc: [Blazor, Razor, Kestrel]
---
Expand Down Expand Up @@ -49,10 +49,11 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af

## SDK

| Title | Type of change | Introduced version |
|----------------------------------------------------------------------------------------------------------------------|-------------------|--------------------|
| [Default workload configuration from 'loose manifests' to 'workload sets' mode](sdk/10.0/default-workload-config.md) | Behavioral change | Preview 2 |
| [MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed](sdk/10.0/custom-build-event-warning.md) | Behavioral change | Preview 1 |
| Title | Type of change | Introduced version |
|----------------------------------------------------------------------------------------------------------------------|---------------------|--------------------|
| [Default workload configuration from 'loose manifests' to 'workload sets' mode](sdk/10.0/default-workload-config.md) | Behavioral change | Preview 2 |
| [MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed](sdk/10.0/custom-build-event-warning.md) | Behavioral change | Preview 1 |
| [NU1510 is raised for direct references pruned by NuGet](sdk/10.0/nu1510-pruned-references.md) | Source incompatible | Preview 1 |

## Windows Forms

Expand Down
52 changes: 52 additions & 0 deletions docs/core/compatibility/sdk/10.0/nu1510-pruned-references.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: "Breaking change - NU1510 is raised for direct references pruned by NuGet"
description: "Learn about the breaking change in .NET 10 where NU1510 is raised for unnecessary direct package references."
ms.date: 3/25/2025
ai-usage: ai-assisted
ms.custom: https://github.com/dotnet/docs/issues/45462
---

# NU1510 is raised for direct references pruned by NuGet

Starting in .NET 10, NuGet raises a [`NU1510` warning](/nuget/reference/errors-and-warnings/nu1510) when a project includes a direct package reference that overlaps with a framework-provided library and is not required.

## Version introduced

.NET 10 Preview 1

## Previous behavior

Previously, the .NET SDK ignored the contents of a package if it overlapped with a framework-provided library. The package reference was allowed but had no effect on the build output.

## New behavior

NuGet now removes unnecessary package references entirely and raises a `NU1510` warning to notify you of the issue.

## Type of breaking change

This is a [source-incompatible change](../../categories.md#source-compatibility).

## Reason for change

This change reduces the maintenance burden on developers by eliminating unused package references. It prevents unnecessary updates, reduces download and restore times, and ensures cleaner build artifacts. The [`NU1510` warning](/nuget/reference/errors-and-warnings/nu1510) warning helps you identify and clean up these references proactively.

## Recommended action

If your project targets only frameworks where the package is pruned, remove the package reference entirely. For multi-targeting projects, conditionally include the package reference only for frameworks that require it. Use the following example as a guide:

```xml
<ItemGroup>
<!-- reference 8.0 System.Text.Json when targeting things older than .NET 8 -->
<PackageReference Include="System.Text.Json" Version="8.0.5" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))" />

<!-- reference 10.0 System.Linq.AsyncEnumerable when targeting things older than .NET 10 -->
<PackageReference Include="System.Linq.AsyncEnumerable" Version="10.0.0-preview.2.25163.2" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net.10'))" />

<!-- Reference System.Memory on frameworks not compatible with .NET Core 2.1 nor .NETStandard 2.1 -->
<PackageReference Include="System.Memory" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp2.1')) and !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.1'))" />
</ItemGroup>
```

## Affected APIs

None.
4 changes: 4 additions & 0 deletions docs/core/compatibility/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ items:
href: sdk/10.0/default-workload-config.md
- name: MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed
href: sdk/10.0/custom-build-event-warning.md
- name: NU1510 is raised for direct references pruned by NuGet
href: sdk/10.0/nu1510-pruned-references.md
- name: Windows Forms
items:
- name: API obsoletions
Expand Down Expand Up @@ -1908,6 +1910,8 @@ items:
href: sdk/10.0/default-workload-config.md
- name: MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed
href: sdk/10.0/custom-build-event-warning.md
- name: NU1510 is raised for direct references pruned by NuGet
href: sdk/10.0/nu1510-pruned-references.md
- name: .NET 9
items:
- name: "`dotnet restore` audits transitive packages"
Expand Down
10 changes: 5 additions & 5 deletions docs/core/testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The test framework is built on top of the test platform. It defines the set of a
For more information, see the following resources:

- [Microsoft.Testing.Platform support in MSTest (MSTest runner)](unit-testing-mstest-runner-intro.md)
- [Unit testing with C#](unit-testing-with-mstest.md)
- [Unit testing with C#](unit-testing-csharp-with-mstest.md)
- [Unit testing with F#](unit-testing-fsharp-with-mstest.md)
- [Unit testing with Visual Basic](unit-testing-visual-basic-with-mstest.md)

Expand All @@ -65,7 +65,7 @@ For more information, see the following resources:
For more information, see the following resources:

- [Microsoft.Testing.Platform support in NUnit (NUnit runner)](unit-testing-nunit-runner-intro.md)
- [Unit testing with C#](unit-testing-with-nunit.md)
- [Unit testing with C#](unit-testing-csharp-with-nunit.md)
- [Unit testing with F#](unit-testing-fsharp-with-nunit.md)
- [Unit testing with Visual Basic](unit-testing-visual-basic-with-nunit.md)

Expand All @@ -80,9 +80,9 @@ For more information, see the following resources:
For more information, see the following resources:

- [Microsoft.Testing.Platform support in xUnit.net v3](https://xunit.net/docs/getting-started/v3/microsoft-testing-platform)
- [Unit testing with C#](unit-testing-with-dotnet-test.md)
- [Unit testing with F#](unit-testing-fsharp-with-dotnet-test.md)
- [Unit testing with Visual Basic](unit-testing-visual-basic-with-dotnet-test.md)
- [Unit testing with C#](unit-testing-csharp-with-xunit.md)
- [Unit testing with F#](unit-testing-fsharp-with-xunit.md)
- [Unit testing with Visual Basic](unit-testing-visual-basic-with-xunit.md)

## Running tests

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unit testing using MSTest sample

This sample is part of the [unit testing tutorial](https://learn.microsoft.com/dotnet/core/testing/unit-testing-with-mstest) for creating applications with unit tests included. See that topic for detailed steps on the code for this sample.
This sample is part of the [unit testing tutorial](https://learn.microsoft.com/dotnet/core/testing/unit-testing-csharp-with-mstest) for creating applications with unit tests included. See that topic for detailed steps on the code for this sample.

## Key features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ Make the *PrimeService.Tests* directory the current directory and create a new p

```xml
<ItemGroup>
<PackageReference Include="MSTest" Version="3.8.3" />
<PackageReference Include="MSTest" Version="3.2.0" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.1" />
</ItemGroup>
```

Expand Down
Loading
Loading