RegAsm returns an error when trying to register my C# x86 dll in a x64 system
===

I've been trying to deal with this for a long time, but could not find any solution.

I have 2 VS2008 projects, one is C# and the other one is C++/CLI. 

The C++/CLI project is Win32 and load some external libraries. I've managed to register this dll using regasm with no problems.

The C# project is configured to x86 and references the C++ project.

The problem is that the regasm tool is kinda unstable when registering my C# dll, it either crashes or shows a quite hard to understand error:

D:\FikusWorks\Source\bin>regasm /tlb SwFCamTree.dll
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.4927
Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

RegAsm : error RA0000 : An error occurred inside the user defined Register/Unregister functions: System.TypeInitializationException: The type initializer for 'SwFCamTree.SwAddin' threw an exception. ---> System.TypeInitializationException:
The type initializer for '<Module>' threw an exception. ---> System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at <CrtImplementationDetails>.ThrowModuleLoadException(String , Exception )
   at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) in f:\dd\vctools\crt_bld\self_x86\crt\src\mstartup.cpp:line 864
   at .cctor() in f:\dd\vctools\crt_bld\self_x86\crt\src\mstartup.cpp:line 901
   --- End of inner exception stack trace ---
   at SwFCamTree.SwAddin..cctor()
   --- End of inner exception stack trace ---
   at SwFCamTree.SwAddin.RegisterFunction(Type t)

If i open depends on the C# generated dll it only shows dependency with MSCOREE.dll and it is 64bit dll, maybe that is causing the problem, but i have no clue how to load the 32bit version of MSCOREE.dll instead.

Thank you very much!