How change the desktop shortcut image of WPF application?
I am creating a WPF Application, and I wanted to publish it. So I created a new Setup and Deployment project, and added my application to it. Now, when I created the setup file and ran it...it created a desktop shortcut. But the image on the deskt开发者_开发百科op shortcut was a windows default, and I want to change it to another icon file. Please tell me how to do that. Thanks.
First, you will need to add an icon to your project. In the properties of your icon, set Build Action to Resource.
Then, in your main Window.xaml file, set the Icon property.
<Window x:Class="..."
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
**Icon="YourIcon.ico"**>
And also you can add an .ico file to user's program files folder. After that you can add the shourtcut to user's desktop. Important point is you should configure the shourtcut's target to that .ico folder.
I hope this helps
Open Properties window of application. In Application section there is "Icon and manifest". Add icon there. More details is here
精彩评论