Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Example messages
error XA1041: The MSBuild property 'MonoAndroidAssetPrefix' has an invalid value of 'c:\Foo\Assets'. The value is expected to be a directory path representing the relative location of your Assets or Resources.
error XA1041: The MSBuild property 'MonoAndroidResourcePrefix' has an invalid value of 'c:\Foo\Resources'. The value is expected to be a directory path representing the relative location of your Assets or Resources.
Issue
The problem is that both MonoAndroidAssetPrefix and MonoAndroidResourcePrefix are expected to be
a relative directory path. This information is used to "strip" the root directory
information off the asset or resource when we package the app.
The error is raised because the property contains a full path.
For example, consider the following structure:
Foo.csproj
MyAssets/
Foo.txt
Subfolder/
Bar.txt
MainActivity.cs
In the final .apk we expect the files Foo.txt and Bar.txt to be placed in the assets folder. In order to do this correctly, the build system needs to know
the name of the folder in which the assets are located. By default this is "Assets", but other folder names are also supported.
In the example above we would expect the user to set MonoAndroidAssetPrefix to a value of "MyAssets". This would ensure that the "MyAssets" part of the path
to "Foo.txt" etc is removed during packaging. If MonoAndroidAssetPrefix is set to
/Users/xxx/Foo/MyAssets or c:\Users\xxx\Foo\MyAssets you would see this error message.
Solution
The fix for this is to not use a full path for the values of MonoAndroidAssetPrefix or MonoAndroidResourcePrefix. They should be a relative
directory path which matches the folder path in which your assets are stored.