The file is not part of the project, or the "Build action" is not set to "Resource",

I get an error

The file / DocomGUI; component / Resources / logo.jpg is not part of the project or its property "Assembly property" is not set to "Resource".

But the file logo.jpg, of course, is part of the project, and the creation action is also set to "Resource".

Project structureFile properties

It is located in a folder /Resources/in the root of the project and is also in a file Resources.resxwith the same name.

Resources file

I tried reinstalling the solution, clearing it and still, the error pops up. What else could go wrong that the file was not found?

The code:

<Window x:Class="DocomGUI.AboutWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="AboutWindow" Height="180" Width="220" Background="LightGray" MinWidth="220" MinHeight="115" MaxWidth="220" MaxHeight="115">
    <Grid>
        <Label Margin="0,66,24,48">DocomGUI</Label>
        <Label Height="30" Margin="12,0,12,12" Name="VersionLabel" VerticalAlignment="Bottom"></Label>
        <Image Margin="12,12,12,0" Stretch="Fill" Height="48" VerticalAlignment="Top" Source="/DocomGUI;component/Resources/logo.jpg" />
    </Grid>
</Window>
+5
source share
2 answers

, visual studio. , .

+4

, . :

<BitmapImage x:Key="logo" UriSource="/Resources/logo.jpg" />

:

<Image Margin="12,12,12,0" Stretch="Fill" Height="48" VerticalAlignment="Top" Source="{StaticResource logo}" />    

, - , .

+2

All Articles