Skip to content

Commit e218f1e

Browse files
author
Cam Soper
authored
[Breaking change] MSBuild Custom Culture Resource Handling (#45527)
Fixes #45501
1 parent abb7e78 commit e218f1e

File tree

4 files changed

+60
-3
lines changed

4 files changed

+60
-3
lines changed

docs/core/compatibility/10.0.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Breaking changes in .NET 10
33
titleSuffix: ""
44
description: Navigate to the breaking changes in .NET 10.
5-
ms.date: 03/25/2025
5+
ms.date: 03/26/2025
66
ai-usage: ai-assisted
77
no-loc: [Blazor, Razor, Kestrel]
88
---
@@ -47,12 +47,13 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
4747
| [X509Certificate and PublicKey key parameters can be null](cryptography/10.0/x509-publickey-null.md) | Behavioral/source incompatible change | Preview 3 |
4848
| [Environment variable renamed to DOTNET_OPENSSL_VERSION_OVERRIDE](cryptography/10.0/version-override.md) | Behavioral change | Preview 1 |
4949

50-
## SDK
50+
## SDK and MSBuild
5151

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

5859
## Windows Forms

docs/core/compatibility/9.0.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Breaking changes in .NET 9
33
titleSuffix: ""
44
description: Navigate to the breaking changes in .NET 9.
5-
ms.date: 12/19/2024
5+
ms.date: 03/26/2025
66
no-loc: [Blazor, Razor, Kestrel]
77
---
88
# Breaking changes in .NET 9
@@ -106,6 +106,7 @@ If you're migrating an app to .NET 9, the breaking changes listed here might aff
106106
| [`dotnet watch` incompatible with Hot Reload for old frameworks](sdk/9.0/dotnet-watch.md) | Behavioral change | RC 1 |
107107
| [`dotnet workload` commands output change](sdk/9.0/dotnet-workload-output.md) | Behavioral change | Preview 1 |
108108
| [`installer` repo version no longer documented](sdk/9.0/productcommits-versions.md) | Behavioral change | Preview 5 |
109+
| [MSBuild custom culture resource handling](sdk/10.0/msbuild-custom-culture.md) | Behavioral change | 9.0.200/9.0.300 |
109110
| [New default RID used when targeting .NET Framework](sdk/9.0/default-rid.md) | Source incompatible | GA |
110111
| [Terminal logger is default](sdk/9.0/terminal-logger.md) | Behavioral change | Preview 1 |
111112
| [Version requirements for .NET 9 SDK](sdk/9.0/version-requirements.md) | Source incompatible | GA |
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: "Breaking change - MSBuild custom culture resource handling"
3+
description: "Learn about the breaking change in MSBuild 17.14 where custom culture resource handling now requires explicit opt-in."
4+
ms.date: 3/26/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/45501
7+
---
8+
9+
# MSBuild custom culture resource handling
10+
11+
Starting in MSBuild 17.14, custom culture resource handling is no longer enabled by default. Users must explicitly opt in to enable this feature. This change prevents unintended behavior caused by automatic detection of directories resembling culture codes.
12+
13+
## Version introduced
14+
15+
MSBuild 17.14
16+
17+
> [!NOTE]
18+
> As this change affects the behavior of MSBuild, it affects two supported versions of .NET: .NET 10 Preview 1 and .NET 9.0.2. The transparent support for custom culture change was introduced in .NET SDK 9.0.200 and the change making it opt-in is in .NET SDK 9.0.300.
19+
20+
## Previous behavior
21+
22+
MSBuild previously treated directories with names resembling culture codes (for example, `en-US`, `fr-FR`) as culture-specific resource directories by default. This behavior sometimes included unrelated directories, such as those with hash-based or technical names, leading to unintended resource assemblies in the build process.
23+
24+
## New behavior
25+
26+
- Custom culture resource handling is disabled by default.
27+
- To enable this feature, set the project property `EnableCustomCulture` to `true`.
28+
- Use the `CustomCultureExcludeDirectories` property to specify a semicolon-delimited list of directory names to exclude from custom culture processing.
29+
30+
## Type of breaking change
31+
32+
This is a [behavioral change](../../categories.md#behavioral-change).
33+
34+
## Reason for change
35+
36+
The automatic detection of culture-specific resource directories caused unpredictable build behavior when directory names coincidentally matched culture codes. Requiring explicit opt-in ensures more predictable builds and gives users greater control over resource handling.
37+
38+
## Recommended action
39+
40+
If your build process relies on custom culture resource handling:
41+
42+
1. Set the project property `EnableCustomCulture` to `true`.
43+
2. Optionally use the `CustomCultureExcludeDirectories` property to exclude specific directories from being treated as culture resources.
44+
45+
## Affected APIs
46+
47+
None.

docs/core/compatibility/toc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ items:
4646
href: sdk/10.0/default-workload-config.md
4747
- name: MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed
4848
href: sdk/10.0/custom-build-event-warning.md
49+
- name: MSBuild custom culture resource handling
50+
href: sdk/10.0/msbuild-custom-culture.md
4951
- name: NU1510 is raised for direct references pruned by NuGet
5052
href: sdk/10.0/nu1510-pruned-references.md
5153
- name: Windows Forms
@@ -174,6 +176,8 @@ items:
174176
href: sdk/9.0/dotnet-workload-output.md
175177
- name: "`installer` repo version no longer documented"
176178
href: sdk/9.0/productcommits-versions.md
179+
- name: MSBuild custom culture resource handling
180+
href: sdk/10.0/msbuild-custom-culture.md
177181
- name: New default RID used when targeting .NET Framework
178182
href: sdk/9.0/default-rid.md
179183
- name: Terminal logger is default
@@ -1910,6 +1914,8 @@ items:
19101914
href: sdk/10.0/default-workload-config.md
19111915
- name: MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed
19121916
href: sdk/10.0/custom-build-event-warning.md
1917+
- name: MSBuild custom culture resource handling
1918+
href: sdk/10.0/msbuild-custom-culture.md
19131919
- name: NU1510 is raised for direct references pruned by NuGet
19141920
href: sdk/10.0/nu1510-pruned-references.md
19151921
- name: .NET 9
@@ -1924,6 +1930,8 @@ items:
19241930
href: sdk/9.0/dotnet-workload-output.md
19251931
- name: "`installer` repo version no longer documented"
19261932
href: sdk/9.0/productcommits-versions.md
1933+
- name: MSBuild custom culture resource handling
1934+
href: sdk/10.0/msbuild-custom-culture.md
19271935
- name: New default RID used when targeting .NET Framework
19281936
href: sdk/9.0/default-rid.md
19291937
- name: Terminal logger is default

0 commit comments

Comments
 (0)