473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
8 3717
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
"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
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
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
"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
>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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Carlos G Benevides | last post by:
I have a ASP.Net web application that has two assemblies that run under com+. Under Windows 2000 the two assemblies are added to com+ automatically when instantiated from the web site. For this...
3
by: RickN | last post by:
We have a C# remoting application that runs thru the web. Assemblies appear to be loaded from the download cache. Is there any way to have them automatically copied to the GAC and be loaded from...
4
by: V. Jenks | last post by:
I'm using reflection to dynamically load an assembly and even though I'm sure the assembly is present, I keep getting an error telling me the "assembly or one of its references can't be found". ...
0
by: TB | last post by:
Hi All: This news group is proving to be great help on my path towards mastering ASP.NET thanks to all of you helpful souls out there. I am looking forward to the day when I can contribute with...
5
by: TB | last post by:
Hi All: This news group is proving to be great help on my path towards mastering ASP.NET thanks to all of you helpful souls out there. I am looking forward to the day when I can contribute...
4
by: Brian Henry | last post by:
My project references Microsoft.MSHTML.Dll. It works perfectly fine on the development machine, but on the release machines that are in production use it says when you try to load a form that uses...
2
by: Kenneth Jonsson | last post by:
I have an COM server in an assembly. When it is deployed on a target computer it needs to be registred with RegAsm. I created a custom action in the deploy project, starting RegAsm with the...
2
by: antonyliu2002 | last post by:
I am testing AJAX. I've downloaded the AJAX Extension and the CTP December package and installed on BOTH my development machine and the production server. Then I created a very very simple web...
10
by: =?Utf-8?B?SmFjayBTbWl0aA==?= | last post by:
Hello, I have a solution that contains a C# application that is installed and runs as a service. The solution also contains several DLLs, some of which are C# assemblies and some are C++ DLLs. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.