1

I have a project that was built in Visual Studio 2005 in C#. I created an installer for the Windows application (in VS2010) and it installs and works fine on Windows XP SP3. I tried installing it on Windows 7 32-bit and it says installation is successful but when I try to open the application I receive this error message:

A fatal error has occurred. Unable to load DLL 'VistaDb20.dll': Invalid access to memory location. (Exception from HRESULT: 0x800703E6)

People suggested I run this in the command line: regsvr32 VistaDb20.dll

I get the error message:

The module "VistaDb20.dll" was loaded but the entry-point DllRegisterServer was not found. Make sure that "VistaDb20.dll" is a valid DLL or OCX file and then try again.

So then I tried regasm VistaDb20.dll /tlb:VistaDb20.tlb using the .NET Framework Assembly Registration Utility 2.0.50727.4927 and get error:

RegAsm : error RA0000 : Failed to load 'VistaDb20.dll' because it is not a valid .NET assembly.

I am not sure how to get my application running on Windows 7 with this .dll problem. Any help would be appreciated. This application and the database was created using VistaDB 2.1

I guess I can't change the actual dll since I did not create it but maybe I have to change some properties of the dll in Visual Studio?

Jens Björnhager
  • 5,632
  • 3
  • 27
  • 47
  • 1
    It doesn't have anything to with registration. The DLL code crashed when it got loaded, typically DllMain(). You'll need a debugger. – Hans Passant Mar 08 '12 at 00:54
  • Thanks Hans. When I run the debugger, the exception DllNotFoundException is caught (invalid access to memory location) here: try { nativeDatabase = new Vista2.VistaDB.VistaDBDatabase(connectionString, false, false); nativeDatabase.Connect(); } catch (Exception e) – tennisbuddy Mar 08 '12 at 16:32

2 Answers2

1

I had this error while trying to registering my VB .NET assembly using RegAsm command:

RegAsm : error RA0000 : Failed to load 'VistaDb20.dll' because it is not a valid .NET assembly.

I solved the problem buy executing RegAsm of the right .NET Framework.

I mean you should use the tools of the same Framework that you make as target in your advanced options of compilation (VS2010).

j0k
  • 22,600
  • 28
  • 79
  • 90
Tamer.bak
  • 26
  • 1
  • Worked for me. Run regasm.exe /? to see which version you are using, then run the correct version directly from the framework path: %windir%\Microsoft.NET\Framework\v2.0.50727\regasm.exe – Walter Sep 25 '12 at 16:28
  • thx, this solve my problem as well, upon %windir%\Microsoft.NET\Framework\ directory there are utilities folders according to .net frw (used right one based your assebmly used) => just little clarification for those who might have same problem – st35ly Sep 04 '14 at 01:14
1

According to this your problem is that this DLL is not compatible with DEP. You'll need to disable DEP to workaround this but in the long term you should try to wean yourself off this particular dependency.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Thanks David. When I try to disable DEP for this program I get the following error: This program must run with data execution protection (DEP) enabled. You cannot turn off DEP for this program. – tennisbuddy Mar 10 '12 at 16:42
  • Well, I can't be sure that DEP is the cause of the problems with that DLL, but if your app requires DEP and the DLL doesn't work with DEP, then you are stuck. What do the vendors of the DLL say? – David Heffernan Mar 10 '12 at 16:43
  • I read some posts on this issue and I would like to clarify that this is a 32-bit application, the application is in the Program Files directory, and the application was complied in XP as mentioned above. Also, I had already added that code to my Post-build event command line that was in the link David provided. – tennisbuddy Mar 10 '12 at 16:49
  • I haven't asked them. I guess that will be my next step. – tennisbuddy Mar 10 '12 at 16:50
  • David, so I asked and VistaDB was acquired by Gibraltar last year so Vista 2 and 3 are no longer available and not supported. No luck there. – tennisbuddy Mar 12 '12 at 17:09