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
If you build a project with $(RunAOTCompilation)=true and $(AndroidStripILAfterAOT)=true, and .NET is installed into a non-user-writable location (e.g. /usr/local on macOS, owned by root):
dotnet new android -n net9-android-filewrite
cd net9-android-filewrite
dotnet build -bl -p:RunAOTCompilation=true -p:AndroidStripILAfterAOT=true
then the build will fail:
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.7/targets/Microsoft.Android.Sdk.Aot.targets(142,5):
error MSB3021: Unable to copy file "obj/Debug/net9.0-android/android-x64/stripped/Microsoft.CSharp.dll" to "/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.android-x64/9.0.0/runtimes/android-x64/lib/net9.0/Microsoft.CSharp.dll".
Access to the path '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.android-x64/9.0.0/runtimes/android-x64/lib/net9.0/Microsoft.CSharp.dll' is denied.
This is concerning because it could work! I have a separate .NET 8 install in $HOME/Downloads/dotnet-sdk-8.0.206-osx-x64, and building a .NET 8 project with this .NET install with these properties set worked:
Moving file from "…/obj/Debug/net8.0-android/android-arm64/aot-in/System.Private.Xml_trimmed.dll" to "$HOME/Downloads/dotnet-sdk-8.0.206-osx-x64/packs/Microsoft.NETCore.App.Runtime.Mono.android-arm64/8.0.11/runtimes/android-arm64/lib/net8.0/System.Private.Xml.dll".
That's bananas.
But wait, it's worse! Try that with a MAUI app -- which pulls in lots of NuGet packages, with assemblies in writable$HOME/.nuget -- and:
Moving file from "…/obj/Debug/net8.0-android/android-arm/aot-in/Xamarin.AndroidX.ExifInterface_trimmed.dll" to "$HOME/.nuget/packages/xamarin.androidx.exifinterface/1.3.6.2/lib/net6.0-android31.0/Xamarin.AndroidX.ExifInterface.dll".
There goes my NuGet cache!
The text was updated successfully, but these errors were encountered:
$(AndroidStripILAfterAOT) is definitely still in the realm of "experimental", should we put that on a doc somewhere?
I don't understand. Are you saying that we should document that if $(AndroidStripILAfterAOT)=true builds will hose your NuGet cache and thus corrupt all future builds? (That's quite the thing to only document.)
We should either fix this post haste, or remove support for $(AndroidStripILAfterAOT) (assuming that's the only thing that triggers the file overwrites).
Android framework version
net8.0-android, net9.0-android
Affected platform version
.NET 8+
Description
If you build a project with
$(RunAOTCompilation)
=true and$(AndroidStripILAfterAOT)
=true, and .NET is installed into a non-user-writable location (e.g./usr/local
on macOS, owned by root):then the build will fail:
This is concerning because it could work! I have a separate .NET 8 install in
$HOME/Downloads/dotnet-sdk-8.0.206-osx-x64
, and building a .NET 8 project with this .NET install with these properties set worked:The binlog contains:
That's bananas.
But wait, it's worse! Try that with a MAUI app -- which pulls in lots of NuGet packages, with assemblies in writable
$HOME/.nuget
-- and:There goes my NuGet cache!
The text was updated successfully, but these errors were encountered: