Conmi的正确答案——Rider中添加icon作为exe的图标

C#版本:.net 8.0
Rider版本:#RD-243.22562.250(非商业使用版)


1、添加图标到解决方案下:
Conmi的正确答案——Rider中添加icon作为exe的图标_第1张图片


2、打开“App.xaml”配置文件,添加配置:

<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.icoImageSource>
    Application.Resources>
Application>

3、打开“MainWindow.xaml”配置文件,添加配置:

<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>

你可能感兴趣的:(c#,Rider)