.net 使用Framework 4.0编译MakeSfxCA.exe和DLL

.net 使用Framework 4.0编译MakeSfxCA.exe和DLL,.net,dll,wix,dtf,.net,Dll,Wix,Dtf,我有一个用Microsoft.NET Framework 4.0编译的dll文件 当我使用MakeSfxCA.exe文件并将dll作为参数之一传递给命令行时,它会给我以下错误消息: D:\SetupManager\test>D:\SetupManager\SetupBuilding\Wix\bin\sdk\makesfxca.exe Fil e2.dll D:\SetupManager\SetupBuilding\Wix\bin\sdk\x86\sfxCA.dll File1.dll Custo

我有一个用Microsoft.NET Framework 4.0编译的dll文件

当我使用MakeSfxCA.exe文件并将dll作为参数之一传递给命令行时,它会给我以下错误消息:

D:\SetupManager\test>D:\SetupManager\SetupBuilding\Wix\bin\sdk\makesfxca.exe Fil e2.dll D:\SetupManager\SetupBuilding\Wix\bin\sdk\x86\sfxCA.dll File1.dll CustomA ction.config Searching for custom action entry points in File1.dll Error: System.BadImageFormatException: Could not load file or assembly 'file:/// D:\SetupManager\test\File1.dll' or one of its dependencies. **This assembly is bui lt by a runtime newer than the currently loaded runtime and cannot be loaded.** File name: 'file:///D:\SetupManager\test\File1.dll' at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boo lean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, E vidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Bool ean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark) at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile) at Microsoft.Deployment.Tools.MakeSfxCA.MakeSfxCA.FindEntryPoints(String modu le) at Microsoft.Deployment.Tools.MakeSfxCA.MakeSfxCA.Build(String output, String sfxdll, IList`1 inputs, TextWriter log) at Microsoft.Deployment.Tools.MakeSfxCA.MakeSfxCA.Main(String[] args) === Pre-bind state information === LOG: User = DSDMAIN\Rajesh LOG: Where-ref bind. Location = D:\SetupManager\test\File1.dll LOG: Appbase = file:///D:/SetupManager/SetupBuilding/Wix/bin/sdk/ LOG: Initial PrivatePath = NULL Calling assembly : (Unknown). === LOG: This is an inspection only bind. LOG: No application configuration file found. LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2 .0.50727\config\machine.config. LOG: Attempting download of new URL file:///D:/SetupManager/test/File1.dll. ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated. D:\SetupManager\test>D:\SetupManager\SetupBuilding\Wix\bin\sdk\makesfxca.exe Fil e2.dll D:\SetupManager\SetupBuilding\Wix\bin\sdk\x86\sfxCA.dll File1.dll CustomA action.config 在File1.dll中搜索自定义操作入口点 错误:System.BadImageFormatException:无法加载文件或程序集的文件:/// D:\SetupManager\test\File1.dll'或其依赖项之一**此总成为bui lt由比当前加载的运行时更新的运行时执行,因此无法加载** 文件名:'file:///D:\SetupManager\test\File1.dll' 在System.Reflection.Assembly.\u nLoad(AssemblyName文件名、字符串代码基、, 证据汇编安全性、汇编位置提示、堆栈爬网标记和堆栈标记、Boo lean throwOnFileNotFound,用于内省的布尔值) 在System.Reflection.Assembly.nLoad(AssemblyName文件名,字符串代码基,E 请参阅assemblySecurity、AssemblyLocationHint、StackCrawlMark和stackMark、Bool ean throwOnFileNotFound,用于内省的布尔值) 在System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,证据 assemblySecurity、StackScrawMark和stackMark,布尔值用于内省) 位于System.Reflection.Assembly.InternalLoadFrom(字符串assemblyFile,证据 securityEvidence,字节[]哈希值,AssemblyHashAlgorithm哈希算法,布尔值 用于自省,stackcrawmark和stackMark) 位于System.Reflection.Assembly.ReflectionOnlyLoadFrom(字符串汇编文件) 在Microsoft.Deployment.Tools.MakeSfxCA.MakeSfxCA.FindEntryPoints(字符串modu (乐) 在Microsoft.Deployment.Tools.MakeSfxCA.MakeSfxCA.Build(字符串输出,字符串 sfxdll、IList`1输入、TextWriter日志) 位于Microsoft.Deployment.Tools.MakeSfxCA.MakeSfxCA.Main(字符串[]args) ==预绑定状态信息=== 日志:User=DSDMAIN\Rajesh LOG:ref绑定的地方。Location=D:\SetupManager\test\File1.dll 日志:Appbase=file:///D:/SetupManager/SetupBuilding/Wix/bin/sdk/ 日志:初始PrivatePath=NULL 正在调用程序集:(未知)。 === 日志:这是一个仅用于检查的绑定。 日志:未找到应用程序配置文件。 日志:使用C:\Windows\Microsoft.NET\Framework\v2中的计算机配置文件 .0.50727\config\machine.config。 日志:正在尝试下载新URLfile:///D:/SetupManager/test/File1.dll. 错误:未能完成程序集的设置(hr=0x801310B)。调查结束了。 感谢您的帮助


提前感谢。

我在CustomActions.config文件中添加了以下代码,并在MakeSfxCA.exe旁边创建了一个MakeSfxCA.exe.config文件,从而遇到了类似的问题

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" />
    </startup>
</configuration>

我的问题略有不同,但可能对其他人有用。
.config
文件必须在项目中具有名称“
CustomAction.config
”。它不能具有名称
.config
,因为重命名项目时会给dll一个唯一的名称。现在看来,
MakeSfxCA
构建工具和
SfxCA
存根依赖于这个文件名