Linking or Compiling Dependencies into a .Net Assembly

B

Benny

I have built a wrapper class as a dll in Visual Studio 2005 using
Visual C++ .Net. When I include the dll in another project, Project
B, on my machine, it works. When I package Project B and deploy it on
another computer, I get an error with the description below:

System.IO.FileLoadException: Could not load file or assembly
'GSLWrapper, Version=1.0.2903.28643, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. This application has
failed to start because the application configuration is incorrect.
Reinstalling the application may fix this problem. (Exception from
HRESULT: 0x800736B1)
File name: 'GSLWrapper, Version=1.0.2903.28643, Culture=neutral,
PublicKeyToken=null' ---> System.Runtime.InteropServices.COMException
(0x800736B1): This application has failed to start because the
application configuration is incorrect. Reinstalling the application
may fix this problem. (Exception from HRESULT: 0x800736B1)

Reinstalling this application does not work. I think it is due to the
missing refrerences for the GSLWrapper.dll. How can I package all of
those dependencies into the dll? I am searching configuration
settings of the C++ project for a way to do this, but I have not
successfully discovered a way to do it.

Please offer suggestions on how to comprehensively package the dll.
 
B

Ben Voigt [C++ MVP]

Benny said:
I have built a wrapper class as a dll in Visual Studio 2005 using
Visual C++ .Net. When I include the dll in another project, Project
B, on my machine, it works. When I package Project B and deploy it on
another computer, I get an error with the description below:

System.IO.FileLoadException: Could not load file or assembly
'GSLWrapper, Version=1.0.2903.28643, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. This application has
failed to start because the application configuration is incorrect.
Reinstalling the application may fix this problem. (Exception from
HRESULT: 0x800736B1)
File name: 'GSLWrapper, Version=1.0.2903.28643, Culture=neutral,
PublicKeyToken=null' ---> System.Runtime.InteropServices.COMException
(0x800736B1): This application has failed to start because the
application configuration is incorrect. Reinstalling the application
may fix this problem. (Exception from HRESULT: 0x800736B1)

Reinstalling this application does not work. I think it is due to the
missing refrerences for the GSLWrapper.dll. How can I package all of
those dependencies into the dll? I am searching configuration
settings of the C++ project for a way to do this, but I have not
successfully discovered a way to do it.

Please offer suggestions on how to comprehensively package the dll.

You can't. All .NET assemblies use dynamic linking, static linking is not
permitted.

At a guess, you used VS2005 SP1 to compile your C++/CLI code, but the user's
machine has only the RTM version of the runtime library. Install the SP1
version of the C++ Runtime Libraries using the exact version that came with
your Visual Studio (the downloadable one isn't exactly right either).
There's a file called vcredist_x86.exe, or there should also be some .msm
merge modules to add to an installer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top