clickonce/wpf图像路径错误
我有一个通过单击一次部署的 WPF 应用程序。在一些笔记本电脑上,当应用程序运行时,它会在登录屏幕上崩溃,因为它无法正确解析屏幕的图像路径。它认为正在寻找的路径是“C:\Users\images\image.jpg”。它应该寻找的是单击一次安装目录...类似于 "C:\users\<用户名>\Appdata\local\apps\2.0\<单击一次生成的路径>\images\ “
等等...
有人遇到类似的问题吗?是权限问题吗?用户说他们正在以管理员身份运行。
任何帮助将不胜感激。
I have a WPF application that is deployed via click-once. On a couple of laptops, when the application runs, it crashes at the login screen because it doesn't properly resolve the image paths for the screen. The path it thinks its looking for is "C:\Users\images\image.jpg". What it should be looking for is the click-once install directory... something like "C:\users\<username>\Appdata\local\apps\2.0\<Click once generated path>\images\"
etc...
anybody run into a similar issue? Is it a permissions thing? The user says they are running as an admin.
any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你想从本地目录读取图像,你可以使用“|DataDirectory|\images\etc.*”
if you want to read image from local directory you can use "|DataDirectory|\images\etc.*"
我不知道具体的答案,但我只会抛出一些可能值得尝试的事情。将无法使用的笔记本电脑上的用户名与可以使用的笔记本电脑上使用的用户名进行比较。是否有空格或有趣的字符?文件夹名称与 \users 文件夹下的用户名是否匹配?如果您以用户身份登录,请检查您是否具有包含图像的文件夹的读取和执行权限?以用户身份登录时真正打开这些文件。
I don't know a concrete answer, but I'll just throw out a couple of things which might be worth trying. Compare the user names on the laptops that don't work to the user names being used on the ones that do. Are there spaces or funny characters? Does the folder name match the username under the \users folder? If you login as the user, check to see do you have read and execute permissions on the folders containing the images? Really open those files when logged in as the user.
首先,将文件的构建操作类型设置为内容类型。然后,尝试使用应用程序中的 Application.startuppath 引用它们。
Firstly, set the Build Action type of your files as content type. Then, try to refer them using Application.startuppath from your application.