Hi everyone. I’m fairly experienced with Monogame and loading content, but I can’t seem to load content for iOS anymore. Even a simple test fails. I recently updated to OSX Catalina and Visual Studio 2019 though. Everything went fine, except for the content loading for iOS.
So I created a basic test, from the command line:
dotnet new mgios -o TestProject
I opened Content/Content.mgcb in the Pipeline Tool to add the texture “test.png”, then built the content, which results in the following:
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:iOS
/config:
/profile:Reach
/compress:False#-------------------------------- References --------------------------------#
#---------------------------------- Content ---------------------------------#
#begin test.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:test.png
When I run the project, it creates the xnb file in the following location:
[project folder]/Content/bin/iOS/Content/test.xnb
I’m not sure why it creates that inside my project’s Content folder or whether it should do that or not. But it’s a newly created project and I didn’t modify anything.
It also creates:
[project folder]/bin/iOS/Content/ (folder is empty)
[project folder]/bin/iPhoneSimulator/Debug/ (folder contains compiled files)
The only line I add to the Draw method of the default Game1.cs is:
Texture2D texture = Content.Load<Texture2D>(“test”);
And that’s where it fails with a ContentLoadException immediately.
I tried to figure out where it tries to look for the xnb file and that seems to be:
Could not find a part of the path “/Users/MacUser/Library/Developer/CoreSimulator/Devices/0BA3132E-4CCA-4192-BEC2-2916AAC01B7E/data/Containers/Bundle/Application/7C5803F0-331B-4212-B7BD-13BA9F927477/TestProject.app/Content/test.xnb”
I don’t know how the xnb files are supposed to get there. This probably has to be done behind the scenes but it clearly doesn’t, not even with a simple test project. I tried to copy the xnb file there by myself but the folder ID under the Application folder seems to change after each run, so no luck there. Manually placing the xnb file in the empty [project folder]/bin/iOS/Content/ folder before running the project also doesn’t seem to make a difference.
I also tried to run the project on an actual iPhone instead of the simulator, but results in the same error. The path is different though, probably of the device itself and also includes folders that seem to be a changing ID.
My iOS projects used to work, so this error is new to me. Does anyone have experience with this and know how I can get the xnb files for iOS in the right place automatically?
Thanks in advance!