Commit 261f7ec
committed
[One .NET] ignore @(Content) from @(ProjectReference)
Fixes: #5299
When setting up `Mono.Android.NET-Tests`, we had to workaround an
error with duplicate `@(Content)` files:
error NETSDK1148: Found multiple publish output files with the same relative path: external\Java.Interop\bin\Release\java-interop.jar, \external\Java.Interop\bin\Release-netcoreapp3.1\java-interop.jar.
Android doesn't support the `@(Content)` build action *at all*, and we
emit a `XA0101` warning if it is used. We even have a test for this.
However, it appears that any `@(Content)` from `@(ProjectReference)`
items are currently brought over in .NET 6, as they get added to the
`@(ResolvedFileToPublish)` item group by the dotnet/sdk.
Luckily there appears to be a `$(_GetChildProjectCopyToPublishDirectoryItems)`
MSBuild property we can set to skip this behavior:
https://github.com/dotnet/sdk/blob/955c0fc7b06e2fa34bacd076ed39f61e4fb61716/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L783-L794
We can set this by default, as we don't need to compute `@(Content)`
items in referenced projects. The library project will emit `XA0101`
and that is enough. I also updated a test that would have triggered
`NETSDK1148` which now works.
I could also see a perf improvement in the `Mono.Android.NET-Tests`
project on Windows:
Before:
GetCopyToPublishDirectoryItems 21ms
After:
GetCopyToPublishDirectoryItems 0ms1 parent 21d3356 commit 261f7ec
File tree
3 files changed
+48
-21
lines changed- src/Xamarin.Android.Build.Tasks
- Microsoft.Android.Sdk/targets
- Tests/Xamarin.Android.Build.Tests
- tests/Mono.Android-Tests
3 files changed
+48
-21
lines changedLines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
Lines changed: 43 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1484 | 1484 | | |
1485 | 1485 | | |
1486 | 1486 | | |
1487 | | - | |
| 1487 | + | |
1488 | 1488 | | |
1489 | | - | |
1490 | | - | |
1491 | | - | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
1492 | 1524 | | |
1493 | | - | |
| 1525 | + | |
| 1526 | + | |
1494 | 1527 | | |
1495 | 1528 | | |
1496 | | - | |
| 1529 | + | |
| 1530 | + | |
1497 | 1531 | | |
1498 | | - | |
1499 | | - | |
| 1532 | + | |
| 1533 | + | |
1500 | 1534 | | |
1501 | | - | |
| 1535 | + | |
1502 | 1536 | | |
1503 | 1537 | | |
1504 | 1538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 36 | | |
49 | 37 | | |
50 | 38 | | |
| |||
0 commit comments