Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将项目添加为引用将导致无法加载文件或程序集或其依赖项之一_C#_Visual Studio 2012_Dll_Wix_Fusion - Fatal编程技术网

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

C# 将项目添加为引用将导致无法加载文件或程序集或其依赖项之一,c#,visual-studio-2012,dll,wix,fusion,C#,Visual Studio 2012,Dll,Wix,Fusion,我在Visual Studio 2012中有一个包含多个项目的解决方案。我试图将一个项目添加到另一个项目中作为引用,以便能够将它们一起使用,但我无法理解为什么添加此项目引用会导致在部署/运行时丢失DLL(FusionLog)。我以前使用过这种方法,但没有这个问题,所以我一定是遗漏了一些东西 解决方案配置: Run Bootstrapper.exe = `Could not load file or assembly 'LicenseCheck, Version=1.0.0.0, Culture=

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

解决方案配置:

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.`
[%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.
主要项目:
Bootstrapper

子项目:
BootstrapperCustom

我试图添加的项目作为参考:
LicenseCheck
BootstrapperCustom

部署时缺少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.`
[%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.
FusionLog(已确认的LicenseCheck.dll丢失):

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.`
[%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复制到输出文件夹中(参见示例)

结果表明这是主项目(WiX引导程序)配置中的内容。我未能将LicenseCheck.dll包括在BootstrapperApplication的有效负载列表中

添加到Bootstrapper\Bundle.wxs:


在解决方案资源管理器中,右键单击并重建该项目。 查看是否在windows资源管理器中重新生成dll。 要使其工作,只需将dll从该项目复制到主项目bin文件夹。它应该会起作用。
这是一个最糟糕的情况,只是开始运行

我知道这不是你的答案,但我带着同样的错误信息来到这里,寻找灵感来寻找什么。事实证明,我引用的项目的目标框架比我的主项目更新。

问题在注释中明确指出,文件是在重建时生成的。