Uh oh!
There was an error while loading. Please reload this page.
[xamarin-android-tools] import $(LibZipSharpVersion) value - #8738
Conversation
Somewhere in the dotnet/maui repo, it encountered the error: XARLP7028 System.IO.FileNotFoundException: Could not load file or assembly 'libZipSharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=276db85bc4e20efc' or one of its dependencies. The system cannot find the file specified.File name: 'libZipSharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=276db85bc4e20efc' at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(IDictionary`2 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments, ICollection`1 proguardConfigFiles) at Xamarin.Android.Tasks.ResolveLibraryProjectImports.RunTask() at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.Note: There is some performance penalty associated with assembly bind failure logging.To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. Graphics (Graphics\src\Graphics) C:\repos\dotnet\maui\bin\dotnet\packs\Microsoft.Android.Sdk.Windows\34.99.0-preview.2.171\tools\Xamarin.Android.EmbeddedResource.targets (don't have a link) If I download our build from main, I see that `Microsoft.Android.Build.BaseTasks.dll` references the 3.0.0.0 version of libZipSharp, while the other MSBuild task assemblies reference the newer one. We override `$(LibZipSharpVersion)` in `Directory.Build.props`, but this value doesn't make it inside the `external/xamarin-android-tools` submodule. Import `Directory.Build.props` from the submodule's `*.override.props` file.
dellis1972
commented
Feb 20, 2024
do we need to change XAT to pull in this file? Looking at the Directory.Build.props in XAT i looks for this in the root of its checkout. |
jonathanpeppers
commented
Feb 20, 2024
It should work, because I've had to use it on some of our servicing branches:
I might move just the NuGet package versions to a new file -- let's see if it works. |
jonathanpeppers
commented
Feb 20, 2024
This appears to work, if I open While the old one had: |
Uh oh!
There was an error while loading. Please reload this page.
jonpryor
commented
Feb 21, 2024
Fixes: https://github.com/dotnet/maui/issues/20752
Context: d1ba2ccdd1377677a6dd24dc13c7a23fd1b8b930
Context: https://github.com/xamarin/xamarin-android-tools/commit/34e98e2b65917d105169f868b5648f67e68b6784
Context: https://github.com/xamarin/xamarin-android/pull/8746`dotnet build` (.NET Core) ignores assembly versions.
`msbuild.exe` (.NET Framework) does not.
Enter d1ba2ccd, which updates the `libZipSharp.dll` assembly version
from 3.0.0.0 to 3.1.1.0. However, this change only impacted
`Xamarin.Android.Build.Tasks.dll`:
% monodis --assemblyref bin/Release/lib/packs/Microsoft.Android.Sdk.Darwin/34.99.0/tools/Xamarin.Android.Build.Tasks.dll…11: Version=3.1.1.0 Name=libZipSharp Flags=0x00000000
It did *not* impact `Microsoft.Android.Build.BaseTasks.dll`, as it
is built by `external/xamarin-android-tools` and was using a
`@(PackageReference)` for libZipSharp 3.0.0:
% monodis --assemblyref bin/Release/lib/packs/Microsoft.Android.Sdk.Darwin/34.99.0/tools/Microsoft.Android.Build.BaseTasks.dll…5: Version=3.0.0.0 Name=libZipSharp Flags=0x00000000
The resulting NuGet package only contains *one*`libZipSharp.dll`,
the 3.1.1.0 version (what `Xamarin.Android.Build.Tasks.dll` refs).
On PR builds and CI, everything was fine, because all the tests we
have use `dotnet build`, and .NET Core ignores assembly versions.
However, if you use *`msbuild.exe`* to invoke the tasks within
`Microsoft.Android.Build.BaseTasks.dll`, things fail:
XARLP7028 System.IO.FileNotFoundException: Could not load file or assembly 'libZipSharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=276db85bc4e20efc' or one of its dependencies.The system cannot find the file specified.File name: 'libZipSharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=276db85bc4e20efc' at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(IDictionary`2 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments, ICollection`1 proguardConfigFiles) at Xamarin.Android.Tasks.ResolveLibraryProjectImports.RunTask() at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25
Fix this by adding an `external/xamarin-android-tools.override.props`
file (xamarin/xamarin-android-tools@34e98e2b) which imports
`Directory.Build.props`, which causes `$(LibZipSharpVersion)` to be
set so that the xamarin-android-tools build uses values provided by
xamarin-android.
TODO: xamarin/xamarin-android#8746 adds a unit test for the
"build with `msbuild.exe`" scenario. |
Fixes: dotnet/maui#20752 Context: d1ba2cc Context: dotnet/android-tools@34e98e2 Context: #8746 `dotnet build` (.NET Core) ignores assembly versions. `msbuild.exe` (.NET Framework) does not. Enter d1ba2cc, which updates the `libZipSharp.dll` assembly version from 3.0.0.0 to 3.1.1.0. However, this change only impacted `Xamarin.Android.Build.Tasks.dll`: % monodis --assemblyref bin/Release/lib/packs/Microsoft.Android.Sdk.Darwin/34.99.0/tools/Xamarin.Android.Build.Tasks.dll … 11: Version=3.1.1.0 Name=libZipSharp Flags=0x00000000 It did *not* impact `Microsoft.Android.Build.BaseTasks.dll`, as it is built by `external/xamarin-android-tools` and was using a `@(PackageReference)` for libZipSharp 3.0.0: % monodis --assemblyref bin/Release/lib/packs/Microsoft.Android.Sdk.Darwin/34.99.0/tools/Microsoft.Android.Build.BaseTasks.dll … 5: Version=3.0.0.0 Name=libZipSharp Flags=0x00000000 The resulting NuGet package only contains *one* `libZipSharp.dll`, the 3.1.1.0 version (what `Xamarin.Android.Build.Tasks.dll` refs). On PR builds and CI, everything was fine, because all the tests we have use `dotnet build`, and .NET Core ignores assembly versions. However, if you use *`msbuild.exe`* to invoke the tasks within `Microsoft.Android.Build.BaseTasks.dll`, things fail: XARLP7028 System.IO.FileNotFoundException: Could not load file or assembly 'libZipSharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=276db85bc4e20efc' or one of its dependencies. The system cannot find the file specified.File name: 'libZipSharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=276db85bc4e20efc' at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(IDictionary`2 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments, ICollection`1 proguardConfigFiles) at Xamarin.Android.Tasks.ResolveLibraryProjectImports.RunTask() at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 Fix this by adding an `external/xamarin-android-tools.override.props` file (dotnet/android-tools@34e98e2b) which imports `Directory.Build.props`, which causes `$(LibZipSharpVersion)` to be set so that the xamarin-android-tools build uses values provided by xamarin-android. TODO: #8746 adds a unit test for the "build with `msbuild.exe`" scenario.
* main: Bump to xamarin/xamarin-android-tools/main@37d79c9 (#8752) Bump to dotnet/installer@d070660282 9.0.100-preview.3.24126.2 (#8763) Bump to xamarin/java.interop/main@14a9470 (#8766) $(AndroidPackVersionSuffix)=preview.3; net9 is 34.99.0.preview.3 (#8765) [Mono.Android] Do not dispose request content stream in AndroidMessageHandler (#8764) Bump com.android.tools:r8 from 8.2.42 to 8.2.47 (#8761) [Mono.Android] fix a set of the "easiest" trimmer warnings (#8731) Bump to dotnet/installer@0a73f814e1 9.0.100-preview.2.24122.3 (#8716) [ci] Always run the MAUI test job (#8750) Add a property required by #8478 (#8749) [xamarin-android-tools] import $(LibZipSharpVersion) value (#8738) Bump to xamarin/Java.Interop/main@c825dcad (#8701) Bump to xamarin/monodroid@cb01503327 (#8742) Bump to xamarin/Java.Interop/main@ae65609 (#8744) Bring in changes from PR #8478 (#8727) [xaprepare] Make 7zip work with "dangerous" symlinks in ZIPs (#8737) Bump NDK to r26c (#8732) Debugging MSBuild Tasks (#8730)
Somewhere in the dotnet/maui repo, it encountered the error:
(don't have a link)
If I download our build from main, I see that
Microsoft.Android.Build.BaseTasks.dllreferences the 3.0.0.0 version of libZipSharp, while the other MSBuild task assemblies reference the newer one.We override
$(LibZipSharpVersion)inDirectory.Build.props, but this value doesn't make it inside theexternal/xamarin-android-toolssubmodule. ImportDirectory.Build.propsfrom the submodule's*.override.propsfile.