參考網址:https://www.lifewire.com/xnb-file-2622568
by Tim Fisher
Updated October 30, 2018
A file with the XNB file extension is an XNA Game Studio Express XNA Framework Content Pipeline Binary file. It's used to save original game files into a proprietary format.
In English: an XNB file is usually a compressed file full of images that appear in a video game created with XNA Game Studio, but they may also contain additional game data like audio files.
Some software might refer to XNB files as compiled asset files.
Note: The XNB file extension looks an awful lot like XMB and might seem similar but XMB files are video game data files used in games like Age of Empires and X-Wing.
How to Open an XNB File
The real source of XNB files is Microsoft XNA Game Studio, a tool that works with Microsoft Visual Studio to help create video games for Microsoft Windows, Windows Phone, Xbox 360, and the (now defunct) Zune. This program, however, isn't a practical tool to extract images from XNB files.
Your best bet is a program called XNB Exporter, which is a portable (meaning no install is necessary) tool that extracts the PNG files from the compressed XNB file you're working with.
The easiest way to use this program is to copy the XNB file into the same folder as the program and then enter the file name of the XNB file without the file extension (e.g. file instead of file.xnb) in XNB Exporter, and then press Go for it!.
You might also be able to open and/or edit XNB files with the GameTools GXView tool.
Note: If you've installed GameTools but can't find GXView, you can open it directly from the installation folder, almost always here: C:\Program Files (x86)\GameTools\GXView.exe.
Tip: Some file types are text-only files and can be opened and viewed with any text editor, like Notepad in Windows, or a more advanced text editor from our Best Free Text Editors list. This isn't the case with any Game Studio XNB file, but if the one you have is a different format, this might be of some help.
If you do manage to get an XNB file opened with a text editor, but it's not entirely composed of text, there may be something within it that identifies the program used to create the file, which you then might be able to use to find a suitable program for opening it.
If the above tools don't open your XNB file, it's possible that yours has nothing to do with XNA Game Studio and isn't a plain text file, in which case it's an entirely different format instead. The best thing to do is to see what folder the XNB file is stored in, and see if that context can help you determine the program that's using it.
Note: If your file doesn't open as explained above, double-check that you're reading the file extension correctly. For example, even though XMB and XNK files resemble the XNB file extension, neither are the same as XMB and therefore don't open with the same programs.
How to Convert an XNB File
A regular file converter will not convert XNB files. The tools we already mentioned above are designed for getting image files out of an XNB file, which is probably what you're wanting to do.
However, you may also try TExtract, TerrariaXNB2PNG, or XnaConvert if the software from above doesn't help.
XNB to WAV lets you copy out the WAV sound file from an XNB file. If you want the WAV file to be in some other sound format like MP3, you can use a free audio converter.