部署后的相对路径 [英] relative path after deployment
本文介绍了部署后的相对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在应用程序文件夹中有一个.jpeg文件,要访问我已经给出路径的文件../image1.jpeg。它在我执行时工作正常。
但在部署时,我可以看到错误找不到路径的一部分../image1.jpeg。
该应用程序在Windows应用程序中。
我在谷歌试过但我无法得到正确的解决方案
请告诉我,如何在部署时访问该路径。
Hi,
I have an .jpeg file in the application folder, to access that file I have given the path as "../image1.jpeg". Its working fine when I am executing it.
but at the time of deployment, I could see the error "Could not find the part of path "../image1.jpeg" ".
The application is in windows application.
I have tried in google but I couldn't get correct solution
Please let me know, how can I access that path at the time of deployment.
推荐答案
使用启动
路径并将图像相对于此路径放置。
例如string exePath = Application.StartupPath +\ image;
Use theStartup
Path and place the image relative to this path.
E.g.string exePath = Application.StartupPath + "\image";
这篇关于部署后的相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文