'Icon resources missing after deploying by Clickonce method

I am developing an outlook add-in, i have a form with a button which has a "Close.png" icon the Imagesource of the button is

<Button.Background>
            <ImageBrush ImageSource="pack://siteoforigin:,,,/Resources/Close.png"/>
            </Button.Background>

, when i deploy the solution using clickonce and after install it successfully and when i tried to run it from outlook y got the following exception message: "\Addin.Outlook\Addin.Outlook\publish\Resources\Close.png", having Content as build action and copy always as copy to output directory. I need some help, cheers.



Solution 1:[1]

If you are making the build action to resource then you should use

<ImageBrush ImageSource="pack://application:,,,/Resources/Close.png"/>

You can set Build action to Copy to Output and use the Siteoforigin in PackURI as

<ImageBrush ImageSource="pack://siteoforigin:,,,/Resources/Close.png"/>

Refer the MSDN

Solution 2:[2]

two steps

  1. build action: content and allways copy(Righ Click on the Icon -> Properties -> Build Action ..)
  2. must be the same folder as .csproj

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ayyappan Subramanian
Solution 2 airways1