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>
相关推荐
Dream achiever12 小时前
8.WPFTextBox控件的鼠标和键盘事件
开发语言·c#·wpf
Dream achiever13 小时前
10.WPF布局
开发语言·c#·wpf
yngsqq13 小时前
Lisp 与 C# 交互中,类型码(TypeCode)的映射关系
开发语言·c#·lisp
ajassi200014 小时前
开源 C# 快速开发(二)基础控件
开发语言·c#
mudtools1 天前
.NET驾驭Word之力:数据驱动文档 - 邮件合并与自定义数据填充完全指南
c#·word·.net
码猩1 天前
wordVSTO插件实现自动填充序号
开发语言·c#
多多*1 天前
linux安装hbase(完)
java·分布式·算法·c#·wpf
℡枫叶℡1 天前
Unity - C#比较两个文件是否相同
unity·c#
专注VB编程开发20年1 天前
c#vb.net动态创建二维数组
windows·c#·vb.net·二维数组