Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File not found: Error for Contents.json when running Xamarin App using a Mac on my network

When trying to run the Xamarin.IOS project of my mobile application I get the following error.

File not found: /Users/USERNAME/Library/Caches/Xamarin/mtbs/builds/MyApp.iOS/665113b8e3040a55db5fc43a003035bd/NLogLogger.xcassets/AppIcons.appiconset/Contents.json

Q1.) I have another project which runs successfully, and that projects checks for the Contents.json file in the directory:

/Users/USERNAME/Library/Caches/Xamarin/mtbs/builds/OtherApp.iOS/665113b8e3040a55db5fc43a003035bd/Assets.xcassets/AppIcons.appiconset/Contents.json

This leads me to think that the issue is coming from Xamarin looking for Contents.json in the wrong directory, any idea how to get it to look in the proper location? (I think this could fix the problem)

Q2. Does anyone understand this error and how to fix it, I have been stuck with this for quite a while now.

Note: I have been focused on the Xamarin.Android for this project and this is the first time I am running it the Xamarin.IOS version.

like image 967
Kikanye Avatar asked Sep 12 '19 21:09

Kikanye


People also ask

Does Xamarin work on Mac?

With Xamarin. Forms, you can use C# or XAML to build cross-platform user interfaces for iOS, Android, and macOS.

How can I use Xamarin without iOS on Mac?

To do it, go to Tools > Options > Environment > Preview Features > Enable Xamarin Hot Restart. Enable it and remember to restart Visual Studio to actually enable it! Now: Set your iOS project as startup project.


1 Answers

I was able to solve it this way:

  1. Right click your ios project > unload project > and edit the csproj file.
  2. Scroll down and delete the following inside the csproj:

.csproj:

<ItemGroup>
    <ImageAsset Include="Assets.xcassets\AppIcons.appiconset\Contents.json">
        <Visible>false</Visible>
    </ImageAsset>
    <ImageAsset Include="Assets.xcassets\LaunchImages.launchimage\Contents.json">
        <Visible>false</Visible>
    </ImageAsset>
</ItemGroup>
  1. Reload csproj.
  2. Clean
  3. Rebuild
like image 68
Tom el Safadi Avatar answered Sep 23 '22 01:09

Tom el Safadi