XamlParseException:无法加载文件或程序集';资源库';或其依赖项之一.系统找不到指定的文件
本文关键字:文件 系统 找不到 依赖 程序集 XamlParseException 资源库 加载 | 更新日期: 2023-09-27 17:59:24
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.
这个问题只是对我自己以及在寻找这个问题的解决方案时来到这里的人的一个参考。
引用中的Copy Local
设置为True
,但未将DLL
复制到生成文件夹中。
由于我只在XAML
中使用了这个资源库,所以我必须添加一个using
语句:
using ResourceLibrary;
在引用代码中(实际上,调用引用代码的代码,即应用程序或单元测试)
这使得DLL
在目标构建目录中创建。
编辑:
有时甚至连using ResourceLibrary
都不起作用。解决方案是在ResourceLibrary
:的代码后面创建一些空的静态方法
namespace ResourceLibrary {
public static class ReferencePoint {
public static ReferToMe() {}
}
}
并从参考代码调用它:
ReferencePoint.ReferToMe();
我遇到了这种情况,因为我运行时启动的应用程序引用了另一个旧位置的DLL。
使用它的实际项目有正确的引用,但启动的应用程序有错误的引用,因此它使用的是旧的DLL。
为了解决这个问题,我删除了启动应用程序上的引用,并再次添加它以指向正确的位置。
我通过将调试平台设置为64位来修复此问题,与参考设置