开发者

MakeSfxCA.exe and DLL compiled with Framework 4.0

I have a dll file compiled with Microsoft .NET Framework 4.0

开发者_如何学Go

When I am using MakeSfxCA.exe file and passing the dll as one of the parameter to command line it gives me following error message:

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.

Any help is appreciated.

Thanks in advance.


My issue was slightly different, but it may be useful to other folks. The .config file has to have the name "CustomAction.config" in your project. It cannot have the name <YourCAProject>.config as will happen when you rename the project to give the dll a unique name. It seems the MakeSfxCA build tool and SfxCA stub depend upon this file name for now.


I got a similar issue working by adding the following code to the CustomActions.config file and creating a MakeSfxCA.exe.config file next to the MakeSfxCA.exe

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜