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>
相关推荐
Python大数据分析@19 小时前
Python 语言有什么奇技淫巧吗?
开发语言·python·c#
Envyᥫᩣ19 小时前
C#中的设计模式:构建更加优雅的代码
开发语言·c#
CHHC18801 天前
C#工作流示例(WorkflowCore)
c#·工作流
oscar9991 天前
少儿编程C++快速教程之——2. 字符串处理
开发语言·c++·c#·字符串·少儿
时光追逐者1 天前
.NET 使用 CsvHelper 快速读取和写入 CSV 文件
c#·.net·.net core·csv
INSO1 天前
查漏补缺之Polly
c#
c#上位机1 天前
wpf中资源的使用
c#·wpf
Zzz_睡不醒1 天前
JS(正则表达式)
javascript·正则表达式·c#
界面开发小八哥2 天前
文档控件DevExpress Office File API v25.1新本亮点:重磅升级各类API
c#·.net·界面控件·devexpress·ui开发
周杰伦fans2 天前
C# 代码中的“熵增”概念
大数据·c#