Skip to content

Commit 7d3eeac

Browse files
authored
Add resource naming breaking change for .NET Core 3.0 (#17044)
* in progress - resource name conventions * add last two rules * add intro * Apply suggestions from Tom Co-Authored-By: Tom Dykstra <[email protected]> * clarify wording * review on staging * fix bookmark links
1 parent 99fa6a2 commit 7d3eeac

File tree

6 files changed

+119
-3
lines changed

6 files changed

+119
-3
lines changed

docs/core/compatibility/2.2-3.0.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,14 @@ If you're migrating from version 2.2 to version 3.0 of .NET Core, ASP.NET Core,
368368

369369
***
370370

371+
## MSBuild
372+
373+
- [Resource manifest file name change](#resource-manifest-file-names)
374+
375+
[!INCLUDE[Resource file names](~/includes/core-changes/msbuild/3.0/resource-manifest-name.md)]
376+
377+
***
378+
371379
## Networking
372380

373381
- [Default value of HttpRequestMessage.Version changed to 1.1](#default-value-of-httprequestmessageversion-changed-to-11)

docs/core/compatibility/2.2-3.1.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,14 @@ If you're migrating from version 2.2 to version 3.1 of .NET Core, ASP.NET Core,
371371

372372
***
373373

374+
## MSBuild
375+
376+
- [Resource manifest file name change](#resource-manifest-file-names)
377+
378+
[!INCLUDE[Resource file names](~/includes/core-changes/msbuild/3.0/resource-manifest-name.md)]
379+
380+
***
381+
374382
## Networking
375383

376384
- [Default value of HttpRequestMessage.Version changed to 1.1](#default-value-of-httprequestmessageversion-changed-to-11)

docs/core/compatibility/msbuild.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: MSBuild breaking changes
3+
description: Lists the breaking changes in MSBuild for .NET Core.
4+
ms.date: 02/10/2020
5+
---
6+
# MSBuild breaking changes
7+
8+
The following breaking changes are documented on this page:
9+
10+
- [Resource manifest file name change](#resource-manifest-file-names)
11+
12+
## .NET Core 3.0
13+
14+
[!INCLUDE[Resource file names](~/includes/core-changes/msbuild/3.0/resource-manifest-name.md)]
15+
16+
***

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
href: /ef/core/what-is-new/ef-core-3.0/breaking-changes?toc=/dotnet/core/compatibility/toc.json&bc=/dotnet/breadcrumb/toc.json
3737
- name: Globalization
3838
href: globalization.md
39+
- name: MSBuild
40+
href: msbuild.md
3941
- name: Networking
4042
href: networking.md
4143
- name: Visual Basic
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
### Resource manifest file names
2+
3+
Starting in .NET Core 3.0, the generated resource manifest file name has changed.
4+
5+
#### Version introduced
6+
7+
3.0
8+
9+
#### Change description
10+
11+
Prior to .NET Core 3.0, when [DependentUpon](/visualstudio/msbuild/common-msbuild-project-items#compile) metadata was set for a resource (*.resx*) file in the MSBuild project file, the generated manifest name was *Namespace.Classname.resources*. When [DependentUpon](/visualstudio/msbuild/common-msbuild-project-items#compile) was not set, the generated manifest name was *Namespace.Classname.FolderPathRelativeToRoot.Culture.resources*.
12+
13+
Starting in .NET Core 3.0, when a *.resx* file is colocated with a source file of the same name, for example, in Windows Forms apps, the resource manifest name is generated from the full name of the first type in the source file. For example, if *Type.cs* is colocated with *Type.resx*, the generated manifest name is *Namespace.Classname.resources*. However, if you modify any of the attributes on the `EmbeddedResource` property for the *.resx* file, the generated manifest file name may be different:
14+
15+
- If the `LogicalName` attribute on the `EmbeddedResource` property is set, that value is used as the resource manifest file name.
16+
17+
Examples:
18+
19+
```xml
20+
<EmbeddedResource Include="X.resx" LogicalName="SomeName.resources" />
21+
-or-
22+
<EmbeddedResource Include="X.fr-FR.resx" LogicalName="SomeName.resources" />
23+
```
24+
25+
**Generated resource manifest file name**: *SomeName.resources* (regardless of the *.resx* file name or culture or any other metadata).
26+
27+
- If `LogicalName` is not set, but the `ManifestResourceName` attribute on the `EmbeddedResource` property is set, its value, combined with the file extension *.resources*, is used as the resource manifest file name.
28+
29+
Examples:
30+
31+
```xml
32+
<EmbeddedResource Include="X.resx" ManifestResourceName="SomeName" />
33+
-or-
34+
<EmbeddedResource Include="X.fr-FR.resx" ManifestResourceName="SomeName.fr-FR" />
35+
```
36+
37+
**Generated resource manifest file name**: *SomeName.resources* or *SomeName.fr-FR.resources*.
38+
39+
- If the previous rules don't apply, and the `DependentUpon` attribute on the `EmbeddedResource` element is set to a source file, the type name of the first class in the source file is used in the resource manifest file name. More specifically, the generated file name is *Namespace.Classname\[.Culture].resources*.
40+
41+
Examples:
42+
43+
```xml
44+
<EmbeddedResource Include="X.resx" DependentUpon="MyTypes.cs">
45+
-or-
46+
<EmbeddedResource Include="X.fr-FR.resx" DependentUpon="MyTypes.cs">
47+
```
48+
49+
**Generated resource manifest file name**: *Namespace.Classname.resources* or *Namespace.Classname.fr-FR.resources* (where `Namespace.Classname` is the name of the first class in *MyTypes.cs*).
50+
51+
- If the previous rules don't apply, `EmbeddedResourceUseDependentUponConvention` is `true` (the default for .NET Core), and there's a source file colocated with a *.resx* file that has the same base file name, the *.resx* file is made dependent upon the matching source file, and the generated name is the same as in the previous rule. This is the "default settings" rule for .NET Core projects.
52+
53+
Examples:
54+
55+
Files *MyTypes.cs* and *MyTypes.resx* or *MyTypes.fr-FR.resx* exist in the same folder.
56+
57+
**Generated resource manifest file name**: *Namespace.Classname.resources* or *Namespace.Classname.fr-FR.resources* (where `Namespace.Classname` is the name of the first class in *MyTypes.cs*).
58+
59+
- If none of the previous rules apply, the generated resource manifest file name is *RootNamespace.RelativePathWithDotsForSlashes.\[Culture.]resources*. The relative path is the value of the `Link` attribute of the `EmbeddedResource` element if it's set. Otherwise, the relative path is the value of the `Identity` attribute of the `EmbeddedResource` element. In Visual Studio, this is the path from the project root to the file in Solution Explorer.
60+
61+
#### Recommended action
62+
63+
If you're unsatisfied with the generated manifest names, you can:
64+
65+
- Modify your resource file metadata according to one of the previously described naming rules.
66+
67+
- Set `EmbeddedResourceUseDependentUponConvention` to `false` in your project file to opt out of the new convention entirely:
68+
69+
```xml
70+
<EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
71+
```
72+
73+
> [!NOTE]
74+
> If the `LogicalName` or `ManifestResourceName` attributes are present, their values will still be used for the generated file name.
75+
76+
#### Category
77+
78+
MSBuild
79+
80+
#### Affected APIs
81+
82+
N/A

includes/core-changes/networking/3.0/httprequestmessage-version-change.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The default value of the <xref:System.Net.Http.HttpRequestMessage.Version?displa
44

55
#### Version introduced
66

7-
.NET Core 3.0
7+
3.0
88

99
#### Change description
1010

@@ -25,8 +25,8 @@ Networking
2525
- <xref:System.Net.Http.HttpRequestMessage.Version?displayProperty=fullName>
2626

2727
<!--
28-
a def
29-
### Affected APIs
28+
29+
#### Affected APIs
3030
3131
- `P:System.Net.Http.HttpRequestMessage.Version`
3232

0 commit comments

Comments
 (0)