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>
相关推荐
李高钢4 分钟前
WPF MVVM Light 入门:从零到Hello World
c#·wpf
曹牧1 小时前
C#:函数参数指定默认值
开发语言·c#
李高钢2 小时前
WPF MVVM Light(三):RelayCommand 命令与 Messenger 消息
前端·c#·wpf
曹牧7 小时前
C#:字符串做20位截断
开发语言·c#
离陌在学C#17 小时前
C# 事件(Event)详解:从概念到实战
开发语言·c#
rockey62719 小时前
C#脚本引擎之AScript与Flee对比
c#·.net·script·eval·动态脚本
zjnlswd1 天前
C#学习笔记4
笔记·学习·c#
曹牧1 天前
C#:List<string>特定格式输出
windows·c#
Z5998178411 天前
c#软件开发学习笔记--Modbus-TCP/UDP网口通讯
笔记·学习·c#
曹牧1 天前
C#:取的多个药品批准文号中的一个
c#