Reputation: 59
I have a xamarin project that it didn't have any problem in visual studio. I don't know why but now I couldn't open the asset catalog to add new images for iOS in visual studio. Can any body help me please?
Upvotes: 3
Views: 4964
Reputation: 11
I had this issue. Am using Xamarin Forms in Windows. My fix:
Upvotes: 1
Reputation: 117
Asset catalogs are supported by Visual Studio but if you need reliable support, manage your asset catalogs in Xamarin Studio and don't edit with Visual Studio.
There are so many issues with Visual Studio (Xamarin Forum) If you want a stable solution open solution in Visual Studio for Mac (former Xamarin Studio) , edit asset catalogs, save and open solution in Visual Studio to work again.
Works for me over a year stable now, but I wish there was a better solution for this.
Upvotes: 0
Reputation: 2812
In my case, it was the ios.csproj file got a little bit corrupted though the app is still compiled and running well. Luckily I have the other iOS app with the editor opened normally. Through comparing, I had seen some redundant entries of json files and png file listed in csproj, as siblings of AppDelegate.cs in the same ItemGroup. Removing these redundant entries in csproj and restarting VS 2017 had resolved the problem and the Assets.xcassets editor is opened normally again.
Upvotes: 0
Reputation: 1448
I solved this problem by removing duplicates in my .csproj file.
By reading Peter's answer it helped me resolve this problem which I have been struggling for quite some time.
I had to create other assets files to hold new images since I couldn't reuse/open the assets files in Visual Studio any longer.
For instance, I had this as a duplicate:
<ImageAsset Include="Resources\Media.xcassets\LaunchImages.launchimage\Contents.json">
<Visible>false</Visible>
</ImageAsset>
Everything is working as it should now.
Upvotes: 2
Reputation: 775
I have had issues with the Asset Catalogs in Visual Studio, the issue for me was two things that both caused the Asset Catalogs not to open:
In the Contents.json there was specified a file (i.e. [email protected]) however there was no entry in the .csproj file, this also includes cases where there was an entry in the csproj file but it was the wrong path:
Add the following (or edit the appropriate) line to the csproj file:
<ImageAsset Include="Resources\Assets.xcassets\image.png.imageset\[email protected]">
<Visible>false</Visible>
</ImageAsset>
In the csproj file for the iOS project, the ImageAsset
tag for the image was with the wrong kind of slashes (which is probably why it sometimes works with Xamarin Studio on MacOS / Linux)
This will look like this when it does not work:
<ImageAsset Include="Resources/Assets.xcassets/image.png.imageset/[email protected]">
<Visible>false</Visible>
</ImageAsset>
Reverse the slashes
<ImageAsset Include="Resources\Assets.xcassets\image.png.imageset\[email protected]">
<Visible>false</Visible>
</ImageAsset>
Upvotes: 3
Reputation: 61
I had the same problem and my solution was:
Assets.xcassets
folder from project.Assets.xcassets
.Upvotes: 6