Visual Studio 2012显示了没有错误的xaml错误

我为一个窗口做的例子:

Icon="/Prayon.Common.Images;component/Application/Prayon.ico"

这很有效,Visual Studio 2010中没有错误.现在,在Visual Studio 2012中,我看到了错误

Could not find a part of the path 'C:\Prayon.Common.Images;component\Application\Prayon.ico'.

在错误列表中.但是Prayon.ico在大会Prayon.Common.Images中是正确引用的.

为什么Visual Studio 2012将此报告为错误?

我可以毫无问题地编译和运行Project. VS2012的ErrorList中只有很多错误消息,这使得很难得到“真正的”错误.

最佳答案 我很确定你以有趣的方式引用图像,

不应该更像这样吗?

pack://application:,,,/Resources/Prayon.png"

或者更准确地说是这个

<Image Source="/ClassLibraryName;Component/images/myimage.png"/> 

您可以在此处找到有关WPF包URI的更多信息:http://msdn.microsoft.com/en-us/library/aa970069.aspx

点赞