简体   繁体   English

导出带有自定义图标的 exe

[英]Exporting exe with custom icon

So I can already export a visual studio c# program to a single file exe.所以我已经可以将 Visual Studio C# 程序导出到单个文件 exe。 What I was curious about is if anyone knows of the console tag for adding a image to the exe or if I would have to do that in the properties beforehand.我很好奇的是,是否有人知道将图像添加到 exe 的控制台标记,或者我是否必须事先在属性中执行此操作。 I tried in properties and it didn't work but any opinions would be great thanks.我在属性中尝试过,但没有奏效,但任何意见都会非常感谢。

XAML XAML

<Window x:Class="WindowSample.MainWindow"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    Title="WPF Window Sample" Height="350" Width="525"  
 Name="FirstWindow" Icon="Icon1.ico" >  

I believe all you have to do is add Icon="" to your <Window>我相信您所要做的就是将Icon=""添加到您的<Window>

In this example the custom icon file is in the project folder, and its named "Icon1.ico".在本例中,自定义图标文件位于项目文件夹中,名为“Icon1.ico”。

  • Note that the icon image file has to be a .ico file.请注意,图标图像文件必须是.ico文件。
  • Also note that the Icon file location can be changed to your preferences.另请注意,图标文件位置可以更改为您的首选项。

If you want even more help you should consider checking out this article.如果您需要更多帮助,您应该考虑查看这篇文章。

From visual studio in the solution explorer right click on the project and select Properties.在解决方案资源管理器中的 Visual Studio 中,右键单击项目并选择属性。 From Application tab in Resources grouping select an icon that icon will be applied to the executable file.从资源分组中的应用程序选项卡中选择一个图标,该图标将应用于可执行文件。 属性页

In addition if you would create a setup project and add shortcut to the desktop then you have to separately select an icon for the shortcut.此外,如果您要创建一个安装项目并将快捷方式添加到桌面,那么您必须单独为快捷方式选择一个图标。 安装包

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM