문제

I'm using Assembly.Load() and then EntryPoint.Invoke(null, null) in order to run a .NET assembly in memory. This works, unless if the host process is x86 and the executed assembly is AnyCPU. In this case, the executed assembly gets executed in x86 context and therefore malfunctions.

Is there a way to execute the Assemly object in an AnyCPU context, even if the host process is x86?

도움이 되었습니까?

해결책

Executing the assembly in AnyCPU context doesn't really make sense. An assembly that targeted AnyCPU will JIT to 64-bit if loaded into a 64-bit process and 32-bit for a 32-bit process. If this assembly is dependent on the host process being 64-bit then it's platform target should be x64 as opposed to Any CPU.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top