简体   繁体   English

发布Vb.net应用程序时如何访问数据文件夹中的文件

[英]How can we access the files in the Data Folder when we publish the Vb.net application

I have added some files that I need to be downloaded to the Application start up path. 我已经添加了一些需要下载到Application启动路径的文件。 So I set Build Action as content now the files have been copied some where 所以我将“ Build Action设置为内容,现在文件已复制到某些位置

C:\Documents and Settings\TestUser.ANNAM\Local Settings\Apps\2.0\Data\HVDRBMY5.8AA\858AT9VM.TNP\test..tion_2d7cfc137d9c2c74_0001.0013_432bd4561850d290\Data

How can access file from the application. 如何从应用程序访问文件。 My problem since it is a dynamic path will it be same folder count so that we can use like ..\\..\\Data\\ Some think like this 我的问题是,因为它是动态路径,所以它的文件夹数是相同的,以便我们可以使用..\\..\\Data\\这样的想法

Application.UserAppDataPath gets the path for the application data of a user. Application.UserAppDataPath获取用户的应用程序数据的路径。

Application.StartupPath gives you the path for the executable file that started the application, not including the executable name. Application.StartupPath为您提供启动应用程序的可执行文件的路径,不包括可执行文件的名称。

Starting with one of these, you should be able to use System.IO to manipulate the paths until you get the folder where your data files are. 从其中之一开始,您应该能够使用System.IO来操纵路径,直到获得数据文件所在的文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM