You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[One .NET] ignore @(Content) from @(ProjectReference) (#5308)
Fixes: #5299
Context: dotnet/sdk#14619
When setting up `Mono.Android.NET-Tests`, we had to work around 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)`][0] MSBuild property
we can set to skip this behavior.
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 0ms
[0]: https://github.com/dotnet/sdk/blob/955c0fc7b06e2fa34bacd076ed39f61e4fb61716/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L783-L794
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets
Copy file name to clipboardExpand all lines: tests/Mono.Android-Tests/Directory.Build.targets
-12Lines changed: 0 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -33,18 +33,6 @@
33
33
DependsOnTargets="_CreateJavaInteropDllConfigs">
34
34
</Target>
35
35
36
-
<!-- When we build the multitargeted Java.Interop project as a dependency of this test project we hit the following error:
37
-
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.
38
-
We do not need to include any of this content in the output directory, so remove it here:
0 commit comments