By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

Own assembly fails to load when vs2008 is not installed on target machine

P: n/a
I have a solution consisting of a c# project as win application and a c++
project as classlibrary. Both are .net 2.0
The classlibrary handles some loading of quicktime movies, but that should
not be relevant.

On my development machine I build the exe and dll and run the exe which has
a reference to the dll. At some point it uses featured in the dll.
This works fine.
Then I copy my exe and dll to the target system and when the featured in the
dll are called, and it is loaded, it fails with a
system.io.fileloadexecption and a detailed message "the assembly with this
name and that culture and this build number or one of its dependencies,
failed to load."
If I try with code such as Assembly.LoadFrom(the fileName of the dll) I get
the same error.

After making sure that the dll did not mis any dependencies on quicktime or
anything else which I use, I give up and want to debug it on the target
system. I install vs2008 and now the program suddenly works fine. I did not
rebuild. I simply installed vs2008 and now the assembly loads without any
problems.
Rather than being happy, I am concerned since I can obviously not begin
distributing vs2008 along with my application. That is why I come running
here for help. What on earth have I been doing wrong?

I might add that the assembly was created through the new project wizard
where I selected a c++ classlibrary. When looking at properties, it has
three dependencies to system, system.data and system.xml and they were all
in the windows folder, where they should be, on the target machine before
installing vs2008.

ANY pointers will be greatly appresiated since I am completely stumped by
now.

Dec 30 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
I made an extremely small test now. A windows forms project .net 2.0 which
tries to load a c++ class library. It works on systems with vs2008, but it
does not work on systems without it. Source and binaries at
www.greenleaf.dk/error.zip .
I must be missing some important point when it comes to using class
libraries.

The loader is just a form with a button which does this
Assembly a=Assembly.LoadFrom("DummyLibrary.dll");

MessageBox.Show(a.FullName);

The classlib is just a new project/other laguages/c++/classlibrary with this
code in the single h file

// DummyLibrary.h

#pragma once

using namespace System;

namespace DummyLibrary {

public ref class Class1
{
// TODO: Add your methods for this class here.
public:
int Add(int a, int b)
{
return a+b;
}

};
}
As I said previoucly. This loads fine n my development machine, but not
else. If I install vs2008 on the other system then the same binaries
suddenly work. It seems that vs installs something which makes this work.
Has it to do with security or something like that? Note that it is not a
problem with absolute vs relative paths. I tried both.

The two micro projects are in this zip www.greenleaf.dk/error.zip It is not
one solution, but two seperate projects to make it even more dead simple.

Dec 31 '07 #2

P: n/a
"Joe Withawk" <no@no.nowrote in message
news:47***********************@dreader1.cybercity. dk...
[...]
system.io.fileloadexecption and a detailed message "the assembly with this
name and that culture and this build number or one of its dependencies,
failed to load."
Try running FUSLOGVW.EXE (which comes with the .Net SDK, I think). This
is the Fusion Log Viewer. It can start the capture of a log of the DLLs that
your program is trying to load, and display all kinds of details about the
version of those libraries and where it is looking for them. This should
give you a good clue about what exactly it is looking for and not finding in
those machines.

Dec 31 '07 #3

P: n/a
Try running FUSLOGVW.EXE (which comes with the .Net SDK, I think). This
is the Fusion Log Viewer. It can start the capture of a log of the DLLs
that your program is trying to load, and display all kinds of details
about the version of those libraries and where it is looking for them.
This should give you a good clue about what exactly it is looking for and
not finding in those machines.
I tried the utility and see the errors, but they make little sence to me.
They seem to deal with for example system.windows.forms.resources not being
there. I appended two of the errors below. Do I understand it correctly as
resources not being in the libraries such as system.windows.forms, but they
exist in the dlls of the framework on the development machine? Why? I
originally had .net 2.0 installed and then installed 3.0 to see if that
changed anything.

Again... In the test (second post zip) I just make an unmanaged classlib in
c++ and try to load it. When vs2008 is installed, it works. When it is not
installed, it fails.

*** Assembly Binder Log Entry (31-12-2007 @ 14:38:37) ***

The operation failed.
Bind result: hr = 0x80070002. Den angivne fil blev ikke fundet.

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msco rwks.dll
Running under executable E:\test\dummylibtest.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = DS1\User
LOG: DisplayName = System.Windows.Forms.resources, Version=2.0.0.0,
Culture=da-DK, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///E:/test/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\machine.config.
LOG: Post-policy reference: System.Windows.Forms.resources, Version=2.0.0.0,
Culture=da-DK, PublicKeyToken=b77a5c561934e089
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL
file:///E:/test/da-DK/System.Windows.Forms.resources.DLL.
LOG: Attempting download of new URL
file:///E:/test/da-DK/System.Windows.Forms.resources/System.Windows.Forms.resources.DLL.
LOG: Attempting download of new URL
file:///E:/test/da-DK/System.Windows.Forms.resources.EXE.
LOG: Attempting download of new URL
file:///E:/test/da-DK/System.Windows.Forms.resources/System.Windows.Forms.resources.EXE.
LOG: All probing URLs attempted and failed.

---

*** Assembly Binder Log Entry (31-12-2007 @ 14:49:52) ***

The operation failed.
Bind result: hr = 0x80070002. Den angivne fil blev ikke fundet.

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msco rwks.dll
Running under executable E:\test\dummylibtest.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = DS1\User
LOG: DisplayName = mscorlib.resources, Version=2.0.0.0, Culture=da,
PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///E:/test/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\machine.config.
LOG: Post-policy reference: mscorlib.resources, Version=2.0.0.0, Culture=da,
PublicKeyToken=b77a5c561934e089
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL
file:///E:/test/da/mscorlib.resources.DLL.
LOG: Attempting download of new URL
file:///E:/test/da/mscorlib.resources/mscorlib.resources.DLL.
LOG: Attempting download of new URL
file:///E:/test/da/mscorlib.resources.EXE.
LOG: Attempting download of new URL
file:///E:/test/da/mscorlib.resources/mscorlib.resources.EXE.
LOG: All probing URLs attempted and failed.

Dec 31 '07 #4

P: n/a
On Dec 31, 8:52*am, "Joe Withawk" <n...@no.nowrote:
* Try running FUSLOGVW.EXE (which comes with the .Net SDK, I think). This
is the Fusion Log Viewer. It can start the capture of a log of the DLLs
that your program is trying to load, and display all kinds of details
about the version of those libraries and where it is looking for them.
This should give you a good clue about what exactly it is looking for and
not finding in those machines.

I tried the utility and see the errors, but they make little sence to me.
They seem to deal with for example system.windows.forms.resources not being
there. I appended two of the errors below. Do I understand it correctly as
resources not being in the libraries such as system.windows.forms, but they
exist in the dlls of the framework on the development machine? Why? I
originally had .net 2.0 installed and then installed 3.0 to see if that
changed anything.

Again... In the test (second post zip) I just make an unmanaged classlib in
c++ and try to load it. When vs2008 is installed, it works. When it is not
installed, it fails.

*** Assembly Binder Log Entry *(31-12-2007 @ 14:38:37) ***

The operation failed.
Bind result: hr = 0x80070002. Den angivne fil blev ikke fundet.

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msco rwks.dll
Running under executable *E:\test\dummylibtest.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = DS1\User
LOG: DisplayName = System.Windows.Forms.resources, Version=2.0.0.0,
Culture=da-DK, PublicKeyToken=b77a5c561934e089
*(Fully-specified)
LOG: Appbase = file:///E:/test/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\machine.config.
LOG: Post-policy reference: System.Windows.Forms.resources, Version=2.0.0.0,
Culture=da-DK, PublicKeyToken=b77a5c561934e089
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL
file:///E:/test/da-DK/System.Windows.Forms.resources.DLL.
LOG: Attempting download of new URL
file:///E:/test/da-DK/System.Windows.Forms.resources/System.Windows.Forms.r*esources.DLL.
LOG: Attempting download of new URL
file:///E:/test/da-DK/System.Windows.Forms.resources.EXE.
LOG: Attempting download of new URL
file:///E:/test/da-DK/System.Windows.Forms.resources/System.Windows.Forms.r*esources.EXE.
LOG: All probing URLs attempted and failed.

---

*** Assembly Binder Log Entry *(31-12-2007 @ 14:49:52) ***

The operation failed.
Bind result: hr = 0x80070002. Den angivne fil blev ikke fundet.

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msco rwks.dll
Running under executable *E:\test\dummylibtest.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = DS1\User
LOG: DisplayName = mscorlib.resources, Version=2.0.0.0, Culture=da,
PublicKeyToken=b77a5c561934e089
*(Fully-specified)
LOG: Appbase = file:///E:/test/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\machine.config.
LOG: Post-policy reference: mscorlib.resources, Version=2.0.0.0, Culture=da,
PublicKeyToken=b77a5c561934e089
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL
file:///E:/test/da/mscorlib.resources.DLL.
LOG: Attempting download of new URL
file:///E:/test/da/mscorlib.resources/mscorlib.resources.DLL.
LOG: Attempting download of new URL
file:///E:/test/da/mscorlib.resources.EXE.
LOG: Attempting download of new URL
file:///E:/test/da/mscorlib.resources/mscorlib.resources.EXE.
LOG: All probing URLs attempted and failed.
Hi Joe,
The error 0x80070002 is a "file not found" error. Is it possible that
you've built your C++ DLL as debug? It's possible that you're linked
to the debug version of some runtime files. Just a guess.

As a next step in debugging, does DEPENDS.EXE show any missing files
on the target machine? Also, what if you cut out .NET from the
equation completely? Can you write a simple C++ console app that
attempts to load the C++ DLL?

John
Dec 31 '07 #5

P: n/a
"Joe Withawk" <no@no.nowrote in message
news:47***********************@dreader1.cybercity. dk...
>I have a solution consisting of a c# project as win application and a c++
project as classlibrary. Both are .net 2.0
The classlibrary handles some loading of quicktime movies, but that should
not be relevant.

On my development machine I build the exe and dll and run the exe which
has a reference to the dll. At some point it uses featured in the dll.
This works fine.
Then I copy my exe and dll to the target system and when the featured in
the dll are called, and it is loaded, it fails with a
system.io.fileloadexecption and a detailed message "the assembly with this
name and that culture and this build number or one of its dependencies,
failed to load."
If I try with code such as Assembly.LoadFrom(the fileName of the dll) I
get the same error.

After making sure that the dll did not mis any dependencies on quicktime
or anything else which I use, I give up and want to debug it on the target
system. I install vs2008 and now the program suddenly works fine. I did
not rebuild. I simply installed vs2008 and now the assembly loads without
any problems.
Rather than being happy, I am concerned since I can obviously not begin
distributing vs2008 along with my application. That is why I come running
here for help. What on earth have I been doing wrong?

I might add that the assembly was created through the new project wizard
where I selected a c++ classlibrary. When looking at properties, it has
three dependencies to system, system.data and system.xml and they were all
in the windows folder, where they should be, on the target machine before
installing vs2008.

ANY pointers will be greatly appresiated since I am completely stumped by
now.

Your C++/CLI dll depends on the VC runtime libraries Version 9 that comes
with VS2008, the dependent libraries and their version are set through a
manifest file that gets embedded in the resulting dll depending on the
project type, for a managed assembly (C++/CLI) your depend on the VCR, so
you need at least to include VCR libraries (see redist under the VC
directory) with your project or you need to install the vcredist package
before or during deployment.

To install the complete VCR on the target system, you'll have to copy
"?:\Microsoft SDKs\v6.0A\Bootstrapper\packages\vcredist_x86 to the target
and run "vcredist_x86.exe".

Willy.

Dec 31 '07 #6

P: n/a
>The error 0x80070002 is a "file not found" error. Is it possible that
>you've built your C++ DLL as debug? It's possible that you're linked
to the debug version of some runtime files. Just a guess.
It was debug. Now I tested with release and it was the same problem.
>As a next step in debugging, does DEPENDS.EXE show any missing files
on the target machine?
When I run depends on the dll it gives an error
"Error: At least one required implicit or forwarded dependency was not
found.
Error: The Side-by-Side configuration information in
"e:\test\DUMMYLIBRARY.DLL" contains errors. Dette program kunne ikke starte
p grund af en forkert programkonfiguration. Du kan muligvis lse problemet
ved at installere programmet igen (14001).
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing
export function in a delay-load dependent module."

The second error message is what I get when trying to load the assembly
runtime.
There are a lot of dependencies where three are missing with file not found.
They are
MSVCM90.DLL
MSVCR90.DLL
MSJAVA.DLL

It seems that a c++ application built with vs2008 for .net 2.0 will not run
on a system with just .net 2.0 installed??
The two first files exist on the system where the assembly will load. They
do not exist on the system where it will not load. Further more, the
datetime on the files match with the time when I installed vs2008. BUT... if
I copy the two files from system to system and download the msjava.dll (does
not exist on dev system) the dependency walker still reports error, but
nothing is missing. The loading of the assembly fails as before, but now
there are apparently no dependencis missing...
>Also, what if you cut out .NET from the
equation completely? Can you write a simple C++ console app that
attempts to load the C++ DLL?
Is a classlibrary not .net? Is it just an ordinary dll with support for
classes?
I will try that, though I wiill not know what to conclude it it works or if
it does not work.? Thanks for the hints btw. I did not know the dependency
walker util

Dec 31 '07 #7

P: n/a
Your C++/CLI dll depends on the VC runtime libraries Version 9 that comes
with VS2008, the dependent libraries and their version are set through a
manifest file that gets embedded in the resulting dll depending on the
project type, for a managed assembly (C++/CLI) your depend on the VCR, so
you need at least to include VCR libraries (see redist under the VC
directory) with your project or you need to install the vcredist package
before or during deployment.

To install the complete VCR on the target system, you'll have to copy
"?:\Microsoft SDKs\v6.0A\Bootstrapper\packages\vcredist_x86 to the target
and run "vcredist_x86.exe".
If you were a little bit closer you would get a great big happy new year
hug!
That was the solution. It sounded as if you knew what the problem was and
you sure did :-)

Thanks for the help! Thanks to the other people here who helped with
debugging tips as well!

Dec 31 '07 #8

P: n/a
On Dec 31, 10:29*am, "Joe Withawk" <n...@no.nowrote:
There are a lot of dependencies where three are missing with file not found.
They are
MSVCM90.DLL
MSVCR90.DLL
MSJAVA.DLL
Looks like depends found that some of the runtime files are missing --
sounds like Willy got your answer for you.
Is a classlibrary not .net? Is it just an ordinary dll with support for
classes?
I will try that, though I wiill not know what to conclude it it works or if
it does not work.? Thanks for the hints btw. I did not know the dependency
walker util
Sorry, I (incorrectly) assumed that your C++ library was not .NET.
Sounds like it is, so never mind. Glad you're up and running.
Dec 31 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.