获取资源文件夹路径C# [英] Get resources folder path c#
问题描述
我在项目中拥有的一些资源很好,可以使用字符串路径正常工作,但是如果我将项目移动到另一个目录或另一台计算机上,它将停止工作.
Some resources I have in my project are fine and working Ok using string paths but what if I move the project to another directory or to another computer, it will stop working.
请以字符串变量获取项目资源文件夹的路径,
Please I need to get the path of the resources folder of my project in a string variable,
类似这样的东西
C:\Users\User1\Documents\<projects folder>\<project name>\Resources\
谢谢.
推荐答案
如果文件存储在项目文件夹中,则可以使用
System.AppDomain.CurrentDomain.BaseDirectory
.
该语句检索有关您的应用程序安装位置的路径.
单击此处对此进行详细说明.
If the files are stored in your project folder, you can retrieve the files using
System.AppDomain.CurrentDomain.BaseDirectory
.
This statement retrieves the path as to where your application is installed.
Click Here to get a detailed explanation on this.
这篇关于获取资源文件夹路径C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!