【发布时间】:2012-07-24 13:34:46
【问题描述】:
我得到了错误
文件 /DocomGUI;component/Resources/logo.jpg 不是项目的一部分,或其“构建操作”属性未设置为“资源”。
但logo.jpg 文件肯定是项目的一部分,并且 Build Actions 也设置为“资源”。
它位于项目根目录的/Resources/ 文件夹中,并且位于同名的Resources.resx 文件中。
我尝试重建解决方案,清理它,但仍然弹出错误。还有什么问题会导致找不到文件?
代码:
<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>
【问题讨论】:
-
可能是删除公司名称的空白。 ;)
-
完全正确 ;-) 很抱歉 - 在你受到诱惑之前:不,文件名在任何地方都是正确的^^
-
@FlorianPeschka:还考虑套管等?你可以让它工作,比如说文件夹图标吗?
-
是的。所有其他图像都可以在同一窗口中正常使用。
-
我曾经通过简单地重新启动 Visual Studio 解决了这个问题,如果一切看起来都正确,那么值得一试。