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>
相关推荐
落寞的星星20 小时前
这个对象就包含了已经转换好的DFA和各种词法分析器运转所需要的参数。下一步,我们就可以用ScannerInfo对象创建出Scanner对象,请看下面的代码:
开发语言·c#
聪慧的水蜜桃1 天前
【YFIOs】用C#开发硬件之设备上云
开发语言·c#
hixiong1231 天前
TensorRT转换工具分享
人工智能·计算机视觉·ai·c#
莫生灬灬1 天前
DY联系人聊天Web面板支持获取联系人/聊天记录/发送消息
前端·chrome·websocket·c#
逝水无殇1 天前
C# 多态性详解
开发语言·后端·c#
逝水无殇1 天前
C# 继承(Inheritance)详解
开发语言·后端·c#
asdzx671 天前
C# 通过模板生成 Word 文档:文本与图片占位符替换完整攻略
开发语言·c#·word
影寂ldy1 天前
C# 泛型协变与逆变
windows·microsoft·c#
F20226974862 天前
西门子 PLC 与 C# 通信
开发语言·c#
吴可可1232 天前
C#实现CAD框选闭合图元外偏移1毫米
c#