访问添加文件到项目文件夹:C# [英] C#: Accessing files added to project folder
问题描述
我如何访问我已经包含在在Visual C#Windows应用程序项目文件夹中的文件...我已经创造了解决方案,一个文件夹,我已经添加了一些文件。现在,我的问题是如何访问它们?
how can i access files I've included in the project folder in Visual C# Windows Application... I've created a folder in the solution and I've added some files. Now, My problem is how to access them?
在ASP.NET C#有RESOLVEURL / Url.Content ...等等...在Visual C#?我应该怎么办?
In ASP.NET C# there is ResolveUrl / Url.Content... etc... In Visual C#? what should i do?
推荐答案
在你可以设置这些文件的属性复制到输出目录
到复制如果新
键,所以每次你运行它们将被复制到斌/调试$ C $应用C>文件夹旁边的可执行文件,并在你的应用程序,你可以访问其视为相对文件:
File.ReadAllText(myfile.txt的);
:
In the properties of those files you could set Copy to Output Directory
to Copy if newer
and so everytime you run the application they will be copied to the bin/Debug
folder alongside with the executable and in your application you could access them as relative files: File.ReadAllText("myfile.txt");
:
这篇关于访问添加文件到项目文件夹:C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!