在创建项目时,我引用了图像路径@..\..\Assets\no_picture_available1.gif
工作正常,当我在其他机器上安装我的应用程序时,它说路径不可用。
我尝试过使用这个
System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"..\..\Assets\no_picture_available1.gif";
它将路径显示为
"F:\\WindowsApp\\UI\\bin\\Debug..\\..\\Assets\\no_picture_available1.gif"
如何设置Assets
文件夹的路径?
答案 0 :(得分:0)
我找到了问题的解决方案,问题在于资产路径, 当我将路径设置为不同时,在发布模式下,我设置了不同的路径。
string pathdir = Path.Combine(System.Windows.Forms.Application.StartupPath, "Assets\\no_picture_available1.gif");
#if DEBUG
return pathdir = @"../../Assets/no_picture_available1.gif";
#else
return pathdir;
#endif