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>
相关推荐
工藤新一OL17 分钟前
把xml的格式从utf-8-bom转为utf-8
xml·c#·asp.net·.netcore·visual studio
henreash1 小时前
NLua和C#交互
开发语言·c#·交互
SAJalon5 小时前
C#集合全面解析
c#
SAJalon6 小时前
C#数组全面解析
c#
henreash7 小时前
xLua和C#交互
开发语言·c#·交互
慢慢沉16 小时前
C#(基本语法)
c#
★YUI★19 小时前
学习游戏制作记录(克隆技能)7.25
学习·游戏·unity·c#
坚持吧202120 小时前
【无标题】word 中的中文排序
开发语言·c#
_oP_i20 小时前
c# openxml 打开加密 的word读取内容
开发语言·c#·word
醉酒的李白、21 小时前
C#观察者模式示例代码
观察者模式·c#