androidvisual-studioxamarin.formsxamarin.android

Deleting images from Resources/Drawable does not delete references in Android.csproj


After I manually deleted images from Resources/Drawable folder in Android project I started receiving a build error: Source file 'Resources\drawable\imagename.png' could not be found. I found out that Android.csproj file was no updated, meaning the references to the images were not deleted. So the question is should I delete unnecessary images manually like this or there is some another way I have to follow, and how to fix the current problem?


Solution

  • If you are deleting something from outside of VS, the project file won't know it was deleted which will cause errors like these. If you don't want to use something, first exclude it from the project, and then delete it or use VS to delete it

    The best way to handle it as of now would be to go to the specific folder. You will see an exclamation mark something like below:

    enter image description here

    To handle this just delete them (from VS menu) and you should be good.