10

System.Windows.Markup.XamlParseExceptionoccurred

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

Additional information: 'Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '21' and line position '6'.

"Could not load file or assembly 'ResourceLibrary, Culture=neutral' or one of its dependencies. The system cannot find the file specified.":"ResourceLibrary, Culture=neutral"

=== Pre-bind state information ===
LOG: DisplayName = ResourceLibrary, Culture=neutral
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: ResourceLibrary, Culture=neutral | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\QTAgent32.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/ResourceLibrary/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/ResourceLibrary/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PublicAssemblies/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PublicAssemblies/ResourceLibrary/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/DataCollectors/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/DataCollectors/ResourceLibrary/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/DataCollectors/x86/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/DataCollectors/x86/ResourceLibrary/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/DataCollectors/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/DataCollectors/ResourceLibrary/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/DataCollectors/x86/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/DataCollectors/x86/ResourceLibrary/ResourceLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/ResourceLibrary/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/ResourceLibrary/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PublicAssemblies/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PublicAssemblies/ResourceLibrary/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/DataCollectors/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/DataCollectors/ResourceLibrary/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/DataCollectors/x86/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/DataCollectors/x86/ResourceLibrary/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/DataCollectors/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/DataCollectors/ResourceLibrary/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/DataCollectors/x86/ResourceLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Documents/projects/Autom/git/Autom/VisCong/VisConf_Tests/bin/Debug/PrivateAssemblies/DataCollectors/x86/ResourceLibrary/ResourceLibrary.EXE.
4

3 回答 3

20

这个问题只是对我自己以及在寻找此问题的解决方案时来到这里的任何人的参考。

参考Copy Local中的 被设置为TrueDLL没有被复制到构建文件夹中。

由于我只在 中使用了这个资源库XAML,所以我不得不添加一个using声明:

using ResourceLibrary;

在引用代码中(实际上是调用引用代码的代码,它是应用程序或单元测试)

这使得DLL在目标构建目录中创建。

编辑:

有时甚至using ResourceLibrary不起作用。解决方案是在代码隐藏中创建一些空的静态方法ResourceLibrary

namespace ResourceLibrary {
    public static class ReferencePoint {
        public static ReferToMe() {}
    }
}

并从引用代码中调用它:

ReferencePoint.ReferToMe();
于 2014-04-22T11:42:32.783 回答
1

这发生在我身上,因为我运行时启动的应用程序引用了另一个旧位置的 DLL。

使用它的实际项目有正确的引用,但启动应用程序有错误的引用,因此它使用的是旧的 DLL。

为了解决这个问题,我删除了启动应用程序上的引用并再次添加它以指向正确的位置。

于 2014-08-21T21:06:02.627 回答
0

我通过将调试平台设置为 64 位来解决此问题,与参考设置相同

于 2021-09-29T07:34:35.950 回答