gpt4 book ai didi

c# - 添加项目作为引用导致无法加载文件或程序集或其依赖项之一

转载 作者:太空宇宙 更新时间:2023-11-03 13:34:14 26 4
gpt4 key购买 nike

我在 Visual Studio 2012 中有一个包含多个项目的解决方案。我正在尝试将一个项目添加到另一个项目作为引用以便能够一起使用它们,但我无法弄清楚为什么添加此项目引用会导致部署/运行时缺少 DLL (FusionLog以下)。我以前用过这种方法没有这个问题所以我一定在这里遗漏了一些东西......

解决方案配置:

主要项目:Bootstrapper
子项目:BootstrapperCustom
我尝试添加为引用的项目:LicenseCheckBootstrapperCustom
部署时缺少 DLL:LicenseCheck.dll

[Bootstrapper]
--Installer: Configuration: N/A, Platform: N/A
--Build: Configuration: Active (Debug), Platform: Active (x86)
--Ref:
----[BootstrapperCustom]

[BootstrapperCustom]
--Application: Configuration: N/A, Platform: N/A, Target framework: .NET 4.5, Output type: Class library
--Build: Configuration: Active (Debug), Platform: Active (Any CPU), Platform target: Any CPU
--Ref:
----[BootstrapperCore] (Copy Local: True)
----[LicenseCheck] (Copy Local: True)
----[Microsoft.Deployment.WindowsInstaller] (Copy Local: True)
----[Microsoft.Practices.Prism] (Copy Local: True)

[LicenseCheck]
--Application: Configuration: N/A, Platform: N/A, Target framework: .NET 4.5, Output type: Class library
--Build: Configuration: Active (Debug), Platform: Active (x86), Platform target: Any CPU
--Ref:
----[Microsoft.Deployment.WindowsInstaller] (Copy Local: True)
----[Parse] (Copy Local: True)

错误信息:

Run Bootstrapper.exe = `Could not load file or assembly 'LicenseCheck, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.`

FusionLog(确认缺少 LicenseCheck.dll):

[%TEMP%\{x}\.ba1]
--BootstrapperCore.dll
--BootstrapperCustom.dll
--Microsoft.Practices.Prism.dll

=== Pre-bind state information ===
LOG: User = NOTTHOR\dirt
LOG: DisplayName = LicenseCheck, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Users/dirt/AppData/Local/Temp/{94ef2c32-a419-410e-a8a0-df404f022ff7}/.ba1/
LOG: Initial PrivatePath = NULL
Calling assembly : BootstrapperCustom, Version=1.0.5028.16514, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\dirt\AppData\Local\Temp\{94ef2c32-a419-410e-a8a0-df404f022ff7}\.ba1\BootstrapperCore.config
LOG: Using host configuration file: C:\Users\dirt\AppData\Local\Temp\{94ef2c32-a419-410e-a8a0-df404f022ff7}\.ba1\BootstrapperCore.config
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/dirt/AppData/Local/Temp/{94ef2c32-a419-410e-a8a0-df404f022ff7}/.ba1/LicenseCheck.DLL.
LOG: Attempting download of new URL file:///C:/Users/dirt/AppData/Local/Temp/{94ef2c32-a419-410e-a8a0-df404f022ff7}/.ba1/LicenseCheck/LicenseCheck.DLL.
LOG: Attempting download of new URL file:///C:/Users/dirt/AppData/Local/Temp/{94ef2c32-a419-410e-a8a0-df404f022ff7}/.ba1/LicenseCheck.EXE.
LOG: Attempting download of new URL file:///C:/Users/dirt/AppData/Local/Temp/{94ef2c32-a419-410e-a8a0-df404f022ff7}/.ba1/LicenseCheck/LicenseCheck.EXE.

注意:当我重建 BootstrapperCustom 项目时,我确实看到在 Bootstrapper\bin\Debug 中生成了 LicenseCheck.dll

最佳答案

您是否尝试查看您正在引用的项目是否使用 LicenseCheck dll 文件,但实际上并没有引用它? (例如:您引用的项目可能在初始化期间动态加载 dll)。

如果是这种情况,您可以添加构建步骤以将 dll 复制到输出文件夹(例如参见 Copying files into the application folder at compile time)

关于c# - 添加项目作为引用导致无法加载文件或程序集或其依赖项之一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19227690/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com