tlbimp.exe generated assembly fails to be registered using regasm.exe

ساخت وبلاگ

Vote count: 0

I have a native COM dll that I want to build a C# interop assembly for. I'm attempting to do this using tlbimp.exe to generate the c# assembly, and I then regasm.exe to register the assembly for transparent use via COM in another program. I'm delay signing since I'm still in a development environment and wish to do some debugging still.

The TlbImp.exe command seems to work fine, the interop file is generated.

c:>tlbimp MyNativeComDll.dll /out:MyInteropDll.dll /publickey:myPublicKey.snk /asmversion:1.6.0.0 /delaysign
TlbImp : Type library imported to C:MyInteropDll.dll
Microsoft .NET Framework Assembly Registration Utility version 4.6.1055.0
for Microsoft .NET Framework version 4.6.1055.0
Copyright (C) Microsoft Corporation. All rights reserved.

Unfortunately, its the regasm call that results in an error that I have no idea how to fix.

C:>regasm C:MyInteropDll.dll
RegAsm : error RA0000 : Could not load file or assembly 'MyInteropDll.dll, Version=1.6.0.0, Culture=neutral, PublicKeyToken=****************' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)

The system I am build this all on is a x64 windows machine running Windows 7sp1. The MyNativeComDll.dll is a x86 library. All this is being done in a vcxproj post build command, the project being the one that builds the MyNativeComDll.dll. I use MSBuild from the command line to build the solution. I have both Visual Studio 2010, and Visual Studio 2015 installed, and the build fails when running the regasm command whether or not I am using VS2010's Win64 or Regular Developers command prompt. Similarly it fails in much the same fashion when using the VS2015 x64 Native Tools command prompt, or the Developer Command Prompt for VS2015.

The command I use to build the solution that contains the project causing the problem is:

C:>msbuild MySolution.sln /p:Configuration=Release /v:n /t:Rebuild /p:Platform="Mixed Platforms"

The solution contains a number of x86 visual c++ projects and a few c# projects which are build as AnyCPU. The resultant main application is supposed to be a 32bit app. All c# projects are targeting .net 4.0.

Why would regasm report that it cannot load the file or assembly? I've looked at the MyInteropDll.dll file in DotPeak and see absolutely no dependencies beyond mscorelib 4.0 listed. Is it a signing problem, or is it a references issue?

asked 2 mins ago

- - , .
.

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 265 تاريخ : جمعه 25 تير 1395 ساعت: 1:10