Error APT0003 Invalid file name: It must contain only [^a-zA-Z0-9_.]+ for file OpenSans-Regular.ttf
See original GitHub issueDescription
I have installed the last version of Visual Studio 2022 preview, 17.1.0 Preview 1.1, and I just created a MAUI project with the template of visual studio and then I try to compile it. I get the following error:
Error APT0003 Invalid file name: It must contain only [^a-zA-Z0-9_.]+ for file OpenSans-Regular.ttf
The project is in a folder which path has not blank spaces, neither another not allowed caracters. This is the complete path of the folder:
C:\proyectos\GestorOrdenadores\GestorOrdenadores.Cliente.XamarinMaui\Resources\Fonts
Thanks.
Steps to Reproduce
1.- Create a MAUI project witth Visual Studio 2022 template 2.- Compile MAUI project
Version with bug
Preview 11
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Andriod
Did you find any workaround?
No response
Relevant log output
Operación Recompilar iniciada...
Se ha restaurado C:\proyectos\GestorOrdenadores\GestorOrdenadores.Service.Grpc.DotNet\GestorOrdenadores.Service.Grpc.DotNet.csproj (en 4,09 sec).
Se ha restaurado C:\proyectos\GestorOrdenadores\GestorOrdenadores.Cliente.Wpf\GestorOrdenadores.Cliente.Wpf.csproj (en 4,1 sec).
Se ha restaurado C:\proyectos\GestorOrdenadores\GestorOrdenadores.Cliente\GestorOrdenadores.Cliente.csproj (en 4,09 sec).
Se ha restaurado C:\proyectos\GestorOrdenadores\GestorOrdenadores.Service.Comun\GestorOrdenadores.Service.Comun.csproj (en 4,12 sec).
1>------ Operación Recompilar todo iniciada: proyecto: GestorOrdenadores.Cliente.XamarinMaui, configuración: Debug Any CPU ------
Se ha restaurado C:\proyectos\GestorOrdenadores\GestorOrdenadores.Cliente.XamarinMaui\GestorOrdenadores.Cliente.XamarinMaui.csproj (en 4,77 sec).
1>Resources\Fonts\OpenSans-Regular.ttf : error APT0003: Invalid file name: It must contain only [^a-zA-Z0-9_.]+.
1>Compilación del proyecto "GestorOrdenadores.Cliente.XamarinMaui.csproj" terminada -- ERROR.
========== Recompilar todo: 0 correctos, 1 incorrectos, 0 omitidos ==========
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (8 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

So the errors are fixed by steps in https://github.com/dotnet/maui/issues/3900
Hey @ComptonAlvaro thanks for the report!
The error is not about the path where your app is but the filename and if you look at that:
OpenSans-Regular.ttfit has a hyphen (-) in there which is not allowed. Android in particular isn’t great at handling “special” characters in filenames, that’s why this safe guard is in place.Rename that file to, for instance:
OpenSansRegular.ttfand it should be fine.If that doesn’t resolve it, please let me know!