WPF application doesn't run in another folder

447 Views Asked by At

My OS is windows 10 and I have a WPF project (dot net 4.6.2 , visual studio community 2017) that runs in release and debug mode without any problem. also i can run it from release or debug folder from my project folder. but when i copy release or debug folder to any other place in my computer , my application runs and show wait cursor and nothing more. my application doesn't need to any source from outside of my project.

1

There are 1 best solutions below

0
AliOsat Mostafavi On BEST ANSWER

I figured it was a problem to set the icon path when I set it for System.Windows.Forms.NotifyIcon.

I created a folder with 'Content' name in my project And then put the icon file inside it.

in xaml , I set window icon "/Content/Icon.ico" and it worked.

for NotifyIcon i set Icon "../../Content/Icon.ico" that it also worked but when I Copy Release folder to another dorectory it didn't work.

So I drag the icon file in Resources and I set the icon of NotifyIcon like this:

 new Icon(Resources.AppIcon,40,40);

This error occurred because I'm confused about how to address the files in WPF.