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>
相关推荐
Nil2085 小时前
leetcode 79单词搜索
开发语言·c#
神仙别闹5 小时前
基于C#实现(WinForm)文件管理系统
java·开发语言·c#
reasonsummer5 小时前
【办公类-146-07】20260906《总园大班6个班级四大教育》(优化版:标题excle+复制AI文字+Python占位符录入)
人工智能·python·c#
玖玥拾6 小时前
Lua 基础语法(六)xLua Lua 调用 C# 交互
开发语言·unity·c#·lua
戌中横8 小时前
数据持久化——PlayerPrefs
c#·数据持久化
曹牧15 小时前
C#:窗体Topmost与获取输入焦点
c#
脉动数据行情117 小时前
C# 实现德指 DAX 期货 WebSocket 实时行情监听
开发语言·websocket·c#
码士集团小青17 小时前
C# 手写向量化能追上 C 吗?
c#
c#上位机19 小时前
tuple_max求数组中的最大值
c#·halcon·机器视觉
xintaiideas1 天前
.NET 项目的多方式启动指南 [特殊字符]
c#