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 开发者_StackOverflow社区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.
if you want to read image from local directory you can use "|DataDirectory|\images\etc.*"
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.
Firstly, set the Build Action type of your files as content type. Then, try to refer them using Application.startuppath from your application.
精彩评论