问题
I'm trying to get the zip file that is located inside the Assets folder of Solution Explorer with the following code. It works well for other types of file like: .txt, .jpg, .png. But it gives error when trying to get the zip file. The system cannot find the file specified.
var zipFile = await Package.Current.InstalledLocation.GetFileAsync("Assets\\Test.zip");
回答1:
Zip files aren't included in the appx package by default (.txt, .jpg, and .png are). Select your file in the solution explorer, look at the zip file's properties, and make sure the build action is set to "Content" so that the file will be included in the Appx:
You can confirm that the file was (or was not) copied to the Appx after deploying from Visual Studio by looking in the (by default) \bin\x86\Release\AppX\Assets directory (or whichever architecture and configuration you deployed).
来源:https://stackoverflow.com/questions/37010421/cannot-access-zip-file-located-in-assets-folder-in-windows-runtime-apps