Skip to content

Invalid file name: It must contain only [^a-zA-Z0-9_.]+. and File name cannot contain '.' other than for specifying the extension #1364

@ghuntley

Description

@ghuntley

Current behavior

When creating a brand new application via the Uno Solution templates blank image assets are created. The filenames of these images are no longer compatible with Xamarin.Android.

Expected behavior

  1. File -> New Uno Solution
  2. Compile Android Application
  3. Compilation success

How to reproduce it (as minimally and precisely as possible)

  1. File -> New Uno Solution
  2. Compile Android Application
  3. Compilation errors

Environment

Nuget Package: master

Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • Windows
  • Build tasks

Visual Studio

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins

  • Resharper (version: )

Anything else we need to know?

https://developercommunity.visualstudio.com/content/problem/671088/regression-invalid-file-name-it-must-contain-only.html

Hi Geoffrey,

This is exactly the issue [1] I linked to in my previous comment. The Uno platform (for some reason) is including those content files into the AndroidResource item group. This is done by this code in the Uno platform itself.

<ResourcesGenerationTask_v0 Resources="@(PRIResource)"

The good news is that those items DO have a LogicalName metadata item which does have a valid filename. So once the fix above is released the app will compile as normal. As I stated in my previous comment this will only effect projects using aapt2. So to work around this issue you can put the following in your csproj

<AndroidUseAapt2>false</AndroidUseAapt2>

or use

/p:AndroidUseAapt2=false

on the command line.

[1] dotnet/android@e0145d1#diff-f8b51db87afcb0cc430594eb134bf41a

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/solution-templatesCategorizes an issue or PR as relevant to the solution templatearea/vswinCategorizes an issue or PR as relevant to Visual Studio for Windowskind/bugSomething isn't workingplatform/android 🤖Categorizes an issue or PR as relevant to the Android platformtriage/most-wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions