iTunes works through the library file. This contains a line by line list of where a file is, which artwork file (in the artwork folder) to associate with it, and the media information read from it. Sometimes this can become corrupt.
If this just happened there are various methods to use an old copy of the library file and hope it isn't a consistent error. In worst case scenario at lest you have your media and you can always rebuild a brand new library from scratch (but lose all playlists, etc.)
iTunes 12.2 "lost " library issue - https://discussions.apple.com/message/28513415#28513415 - seems to work for some
First determine if the media files are still present in the iTunes > Media folder. If they are not you will have to restore them from the backup you of course made of your computer before installing new software, or from their original sources. If they are still there then try one of the following methods to rebuild the database which tells iTunes what media you have in your collection and where it is.
ASC user turingtest2 help document: Empty/corrupt iTunes library after upgrade/crash - https://discussions.apple.com/docs/DOC-6561
Here are the two main methods. Method 1 does revert your library list (but not media files) to the state it was at the time indicated on the file but all metadata are preserved. Method 2 may permit using a more recent version (.xml) of your iTunes library than a previous .itl version but you have to be willing to accept loss of some metadata.
1) iTunes: How to re-create your iTunes library and playlists - https://support.apple.com/en-us/HT201561 - These instructions have you open iTunes with an old iTunes library file archived at the time you last updated iTunes. This will revert your library content list and appearance to what it was at the date indicated on the file. Newer media not in this list will still be in your media folder. You can re-add these by dragging your media folders to the Automatically Add To iTunes folder but they will regarded as brand new items.
A method 1 shortcut that seems to work with more recent iTunes versions - https://discussions.apple.com/message/28484935#28484935 - However, I have not tried this and would want to make sure it didn't start creating additional files and folders inside the "previous libraries" folder that doing things the official way would avoid.
2) If you don't see your content after updating iTunes - https://support.apple.com/en-us/HT203225 - These instructions use a trimmed-down version of your library file to rebuild your primary library file. You lose some metadata (ratings, play count, date added) but the listing should be fairly up to date.