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
{{ message }}
Repository navigation
[AOT] Failure when the path to the temp folder contains accentuated characters and/or spaces #9523
On Windows, when building with AOT enabled, and the user home folder has an accentuated character and/or a space, the build fails with:
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.145\targets\Microsoft.Android.Sdk.Aot.targets(109,5): Precompiling failed for E:\Net2022files\WinNavUno5\WinNavUno5\obj\Release\net8.0-android\android-x64\linked\_Microsoft.Android.Resource.Designer.dll with exit code 1.
The specified response file can not be read [E:\Net2022files\WinNavUno5\WinNavUno5\WinNavUno5.csproj]
Steps to Reproduce
Build an app with AOT enabled, with a user folder with accentuated characters and/or spaces.
Did you find any workaround?
Changing the user folder path to be without spaces and accentuated characters.
I noticed this particular behavior when accounts are created using MS Entra Online-only (Azure AD) accounts, where the tooling does not "normalize" the folder to 7-bits ASCII and uses the user's original name instead of the SAMAccount field.
My own name has an accent in it, and it's also causing all sorts of issues which I avoid by changing the folder from the get-go...
@jonathanpeppers it's definitely still happening, with an earlier error now:
Microsoft.Android.Sdk.Windows\35.0.78\tools\Xamarin.Android.Aapt2.targets(214,3): error APT2264: The system cannot find the file specified. (2): D:\temp\Issue9532\MauiApp4_with_é\obj\Debug\net9.0-android\assets.
This could be caused by the project exceeding the Windows maximum path length limitation.
See https://learn.microsoft.com/dotnet/android/messages/apt2264 for details.
[D:\temp\Issue9532\MauiApp4_with_é\MauiApp4.csproj]
@jonathanpeppers it's definitely still happening, with an earlier error now:
Microsoft.Android.Sdk.Windows\35.0.78\tools\Xamarin.Android.Aapt2.targets(214,3): error APT2264: The system cannot find the file specified. (2): D:\temp\Issue9532\MauiApp4_with_é\obj\Debug\net9.0-android\assets.
This could be caused by the project exceeding the Windows maximum path length limitation.
See https://learn.microsoft.com/dotnet/android/messages/apt2264 for details.
[D:\temp\Issue9532\MauiApp4_with_é\MauiApp4.csproj]
77a6606 would've probably caused a more appropriate build error in net10.
That said, I tried manually running the aapt2.exe command and if I replace the non-ascii path in the -A option with just a relative path then the command works (even though other arguments contain the non-ascii path), and if I build again after that everything works and I get an .apk.
@dellis1972@jonathanpeppers Maybe a workaround would be to calculate a relative path for passing to the -A option?
@dellis1972@jonathanpeppers Maybe a workaround would be to calculate a relative path for passing to the -A option?
We can't. The aapt2 is run as a daemon for faster resource processing. This has to be done in the temp directory otherwise it messes with Visual Studio (it thinks the directory/files are locked). So we have to pass ALL paths as full paths to the aapt2 process.
We only run up the aapt2 for the build, so it doesn't hang around, but VS still has issues it seemed.
@jonathanpeppers , this is still happening with .NET 10. On top of that if you use dotnetup in its default config (at least on macOS) it will also cause this problem as it installs to /Users/{user}/Library/Application Support/dotnetup/. I don't know if there is someone on that team to ping about possibly changing the default config to ~/.dotnetup/dotnetup or if the resolution needed is with fixing something in net-android.
Repro goes as such.
Install dotnet into ~/dotnet up/ (custom path just to replicate later that custom paths do work).
cd ~
mkdir "dotnet up"
dotnetup init --install-path "/Users/{user}/dotnet up"
Reload terminal. I found I just had to create a new tab, source ~/.zprofile didn't work and I don't recall the zsh command to reload shell.
Create new folder, install android workloads, build for release.
mkdir dotnetupandroidtest
cd dotnetupandroidtest
dotnet workload install android
dotnet new android
dotnet build -c Release
Errors with 16 errors of "Precompiling failed for", 4 for each arch.
Cleanup
cd ~
rm -rf "dotnet up"
rm -rf "dotnetupandroidtest"
Trying again but with a better setup directory with no space.
cd ~
mkdir "dotnetup"
dotnetup init --install-path "/Users/{user}/dotnetup"
reload terminal
mkdir dotnetupandroidtest
cd dotnetupandroidtest
dotnet workload install android
dotnet new android
dotnet build -c Release
This one works fine because there is no space in the dotnet path.
I have not tried .NET 11 at all unfortunately. Thanks to dotnetup though and the ability to nuke dotnet from my system (if something bad happens) and re-add it within minutes I will certainly try. I'll get back to you.
I cleared my system of dotnet, did dotnetup init and installed latest preview in default directory, then did the same think to make a blank Android app. That built the app fine 👍
Activity
dellis1972 commentedon Nov 18, 2024
@jeromelaban very odd. So the temp folder path has an accented character in it :(
@akoeplinger any idea who works on the
\mono-aot-cross.exe? Looks like an issue in that area.jeromelaban commentedon Nov 18, 2024
It is odd indeed.
I noticed this particular behavior when accounts are created using MS Entra Online-only (Azure AD) accounts, where the tooling does not "normalize" the folder to 7-bits ASCII and uses the user's original name instead of the SAMAccount field.
My own name has an accent in it, and it's also causing all sorts of issues which I avoid by changing the folder from the get-go...
akoeplinger commentedon Nov 19, 2024
would you mind trying with dotnet 9? there were some related fixes in that area.
jonathanpeppers commentedon Jul 11, 2025
Let us know if this is still happening in .NET 9, thanks.
jeromelaban commentedon Jul 15, 2025
@jonathanpeppers it's definitely still happening, with an earlier error now:
Issue9532.zip
dellis1972 commentedon Jul 15, 2025
That is a bug in
aapt2its not something we can deal with unfortunately, without getting in a fixing aapt2 :(akoeplinger commentedon Jul 21, 2025
77a6606 would've probably caused a more appropriate build error in net10.
That said, I tried manually running the aapt2.exe command and if I replace the non-ascii path in the
-Aoption with just a relative path then the command works (even though other arguments contain the non-ascii path), and if I build again after that everything works and I get an .apk.@dellis1972 @jonathanpeppers Maybe a workaround would be to calculate a relative path for passing to the
-Aoption?dellis1972 commentedon Jul 21, 2025
We can't. The
aapt2is run as adaemonfor faster resource processing. This has to be done in the temp directory otherwise it messes with Visual Studio (it thinks the directory/files are locked). So we have to pass ALL paths as full paths to theaapt2process.We only run up the
aapt2for the build, so it doesn't hang around, but VS still has issues it seemed.akoeplinger commentedon Jul 21, 2025
Ah okay, interesting. Maybe we could copy the assets directories to the temp directory and delete them after aapt2 is done (for non-ascii paths).
Or is it possible to disable the the daemon mode for aapt2 if we detect non-ascii paths?
dellis1972 commentedon Jul 21, 2025
The problem with that is people tend to put large files in
assets, we don't really want to be copying them around unless we really have to.Its not really setup that way unfortunately
This is the code https://github.com/dotnet/android/blob/main/src/Xamarin.Android.Build.Tasks/Utilities/Aapt2Daemon.cs.
We could possibly try putting the working directory in
objagain, things might have changed in VS with the new project system.beeradmoore commentedon Oct 21, 2026
@jonathanpeppers , this is still happening with .NET 10. On top of that if you use dotnetup in its default config (at least on macOS) it will also cause this problem as it installs to
/Users/{user}/Library/Application Support/dotnetup/. I don't know if there is someone on that team to ping about possibly changing the default config to~/.dotnetup/dotnetupor if the resolution needed is with fixing something in net-android.Repro goes as such.
Install dotnet into
~/dotnet up/(custom path just to replicate later that custom paths do work).Reload terminal. I found I just had to create a new tab,
source ~/.zprofiledidn't work and I don't recall the zsh command to reload shell.Create new folder, install android workloads, build for release.
Errors with 16 errors of "Precompiling failed for", 4 for each arch.
Cleanup
Trying again but with a better setup directory with no space.
reload terminal
This one works fine because there is no space in the dotnet path.
jonathanpeppers commentedon Oct 21, 2026
@beeradmoore have you had more success with .NET 11?
The issue here is in dotnet/runtime's Mono AOT compiler, which is not going to be used anymore going forward.
CoreCLR will use ReadyToRun instead, which is completely different.
beeradmoore commentedon Oct 21, 2026
I have not tried .NET 11 at all unfortunately. Thanks to dotnetup though and the ability to nuke dotnet from my system (if something bad happens) and re-add it within minutes I will certainly try. I'll get back to you.
beeradmoore commentedon Oct 27, 2026
I cleared my system of dotnet, did
dotnetup initand installed latest preview in default directory, then did the same think to make a blank Android app. That built the app fine 👍