Conmi的正确答案——Rider中添加icon作为exe的图标

C#版本:.net 8.0

Rider版本:#RD-243.22562.250(非商业使用版)


1、添加图标到解决方案下:


2、打开"App.xaml"配置文件,添加配置:

xml 复制代码
<Application
    x:Class="ComTransmit.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ImageSource x:Key="ComTransmitIcon">ComTransmitIcon.ico</ImageSource>
    </Application.Resources>
</Application>

3、打开"MainWindow.xaml"配置文件,添加配置:

xml 复制代码
<Window
    x:Class="ComTransmit.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Title="MainWindow" Height="450" Width="800">
    <Window.Icon>
        <StaticResource ResourceKey="ComTransmitIcon" />
    </Window.Icon>
    <Grid />
</Window>
相关推荐
L X..2 小时前
Unity 光照贴图异常修复笔记
unity·c#·游戏引擎
reasonsummer4 小时前
【办公类-115-06】20250920职称资料上传04——docx复制、docx转PDF(课程表11个)
开发语言·windows·python·c#
William_cl19 小时前
一、前置基础(MVC学习前提)_核心特性_【C# 泛型入门】为什么说 List<T>是程序员的 “万能收纳盒“?避坑指南在此
学习·c#·mvc
c#上位机1 天前
wpf之命令
c#·wpf
曹牧1 天前
C#:函数默认参数
开发语言·c#
R-G-B1 天前
【02】C#入门到精通——C# 变量、输入/输出、类型转换
开发语言·c#·c# 变量·c#输入/输出·c#类型转换
星河队长1 天前
C# 软件加密方法,有使用时间限制,同时要防止拷贝
开发语言·c#
Aevget2 天前
DevExpress WinForms v25.1亮点 - PDF Viewer(查看器)等全新升级
pdf·c#·界面控件·winform·devexpress·ui开发
InCerry2 天前
为 .NET 10 GC(DATAS)做准备
性能优化·c#·.net·gc
曹牧2 天前
C#:可选参数
开发语言·c#