xamarin-macios icon indicating copy to clipboard operation
xamarin-macios copied to clipboard

NativeReferences with Include's that have a trailing / are ignored without obvious warning/error

Open chamons opened this issue 3 years ago • 2 comments

If your NativeReference has a trailing / it is completely ignored FWICT:

<NativeReference Include="/Users/donblas/Programming/Projects/Microsoft.Maui.Platform.Channels/Platforms/Apple/Sample/build/Debug-maccatalyst/Sample.framework/"  Kind="Framework"  />

Steps to Reproduce

  1. Create a new ios project and have a native framework you want to include
  2. Add this to your csproj (fix path as needed) - Note the trailing '/' character
		<NativeReference Include="/Users/donblas/Programming/Projects/Microsoft.Maui.Platform.Channels/Platforms/Apple/Sample/build/Debug-maccatalyst/Sample.framework/"  Kind="Framework"  />
  1. Build, and note lack of framework included, mostly silently

Expected Behavior

'/' to be ignored or a hard error

Actual Behavior

No framework and a confused developer

Build Logs

msbuild.binlog.zip

Example Project (If Possible)

https://github.com/chamons/Microsoft.Maui.Platform.Channels/commits/swift @ e89bded092236327dd8ca2c9b7c807aab1b05301

chamons avatar Jul 08 '22 16:07 chamons

FYI @rolfbjarne

chamons avatar Jul 08 '22 16:07 chamons

I believe this is because we compare '%(Extension)' to '.framework' here:

https://github.com/xamarin/xamarin-macios/blob/b1a732d5260dbf6a100c7f126df720e6698c740f/msbuild/Xamarin.Shared/Xamarin.Shared.targets#L133-L135

We also do it here:

https://github.com/xamarin/xamarin-macios/blob/6b5ce1401fd6fe3c62816e4d100423484bd4b412/dotnet/targets/Xamarin.Shared.Sdk.targets#L1468-L1473

rolfbjarne avatar Sep 05 '22 13:09 rolfbjarne