Cannot access Zip File located in Assets folder in Windows Runtime Apps

橙三吉。 提交于 2021-01-29 03:41:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!