473,395 Members | 1,675 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,395 software developers and data experts.

Problem with Assembly Paths

Hi,
at the moment we have very strange problems with assembly directories:

Following is the main structure of our project:
- An ActiveX-control in "d:\TheProject\bin\debug" which is developed
by us. It opens an assembly in the same directory (lets call it
MainAssembly). That assembly contains a control which is then
displayed in the ActiveX-control

- Some app under "c:\Program Files", which loads an ActiveX and
displays it. Note that there may be different apps from different
vendors - it's an industry standard specification (FDT) which you can
compare to a plugin system based on COM. FDT applications scan the
registry for a COM components that are registered under a specific COM
category. The found components are then hosted. Our ActiveX is such a
component.

The COM-stuff works as expected. Our problem is this:

in the assembly we use Microsoft CAB. All three assemblies
Microsoft.Practices.CompositeUI.dll,
Microsoft.Practices.CompositeUI.WinForms.dll and
Microsoft.Practices.ObjectBuilder.dll are in our directory "d:
\TheProject\bin\debug"

This code example from our MainAssembly doesn't work:
private void CrashTest()
{
try
{
Test1();
Test2();
Test3(); // =throws an exception!
}
catch (Exception err)
{
}
}

private void Test1()
{
Type t = typeof (WorkItem); // Class in
Microsoft.Practices.CompositeUI.dll
}

private void Test2()
{
Type t = typeof(Builder); // Class in
Microsoft.Practices.ObjectBuilder.dll
}

private void Test3()
{
Type t = typeof(DeckWorkspace); // Class in
Microsoft.Practices.CompositeUI.WinForms.dll
}

I put a breakpoint into Test3() but that one won't be hit. Instead a
FileNotFoundException will be thrown when I try to step into this
function. The message is this:

"The file or assembly Microsoft.Practices.CompositeUI,
Version=1.0.51205.0, Culture=neutral, PublicKeyToken=4ca05d3ac5586cd9
or a dependency of it wasn't found. The system cannot find the
specified file."

But this is really strange, because in Test1() exactly this assembly
is loaded. I also checked this manually by examining
typeof(WorkItem).Assembly.Location.

Next I added an event handler to the AppDomain's AssemblyResolve-
event: it was fired with args.Name =
"Microsoft.Practices.CompositeUI.dll". When I return
typeof(WorkItem).Assembly, it works.

Has anybody a reasonable explanation for this behaviour? I think it
may be associated somehow with the main application because it is in a
different directory. When I use a small test application in the d:
\TheProject\bin\debug-directory, everything works fine. Btw isn't it
strange that the MainAssembly can be called? I thought that assemblies
can only be called when they're in the same directory as the
application, in a subdirectory, in the GAC or if the .config-file of
the application specifies the assembly's directory.

I have absolutely no clue what's going on here and each hint is more
than welcome,

mfg Steven

Aug 31 '07 #1
0 1387

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Yang Liu | last post by:
Hi all, I have a .net windows application xx.exe, which reference a private assembly yy.dll, the property "local copy" of the yy.dll reference is automatically set to true, so the yy.dll will be...
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". ...
3
by: Daniel Billingsley | last post by:
Today I went to compile a solution I've been working on for months. I've been off most of the last few months, so there's been a gap in the work, but I did compile it a few times earlier this...
4
by: Julia | last post by:
Hi, I have two application which 'evaluate'( New FileStream(path....) relative path, when evaluating the path inside a window service it always return something like ...
0
by: Brandon | last post by:
Hello all, and thanks for taking a look at this. First off, the project I am working on is a server/client application that contains a shared assembly of common classes between the two...
6
by: Mats-Lennart Hansson | last post by:
Hi, Is there a way to define where the assembly should search for its referenced assemblies? I have my assemblies in different locations and I don't want to add them the GAC. Any help is...
8
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set...
5
by: Luis Arvayo | last post by:
When I load an assembly at runtime, that is to say, a plugin DLL through Assembly.Load, an old version of the assembly is loaded. If I recompile the DLL and then copy the result to where the...
6
by: Terrance | last post by:
I currently experimenting with VB.net 2005 express edition. I was wondering if anyone knows how to deploy an assembly to the global assembly cache using the express edition? I tried using the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.