[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Could not load file or assembly. cannot find the file specified.

Posted on 2012-08-15
10
Medium Priority
?
1,164 Views
Last Modified: 2012-08-16
I am a not a new .NET programmer and should be able to figure this out myself,  but I am stumped someone please help!

Here is the first error I am dealing with.

Could not load file or assembly Infragistics2.Win.v9.2, version=..., or one of its dependencies. The system cannot find the file specified.

So I have an application (IPAPSig) that works on my dev machine but gives the above error when it loads on a newly installed XP Pro sp3 (virtual) machine. The listed file is located in the GAC along with all of the rest of the Infragistics toolset.

I have copied all of the Infragistics files into the startup directory. With the files in the startup directory I get a different error as follows:

Could not load file or assembly Infragistics2.Win.v9.2, version=..., or one of its dependencies. The located assembly's manifeest definition does not match the assembly reference (Exception from HRESULT: 0c80131040)

So I take the files from the startup directory and drop them in the GAC and remove them from the startup directory. When I run IPAPSig I am back to "cannot find the file specified".

These files are the same exact files that I compiled with.

OK That is confusing but here is the really confusing part. I have another app called IPAP.
IPAPSig is a duplicate of the IPAP code. Software to capture signatures was added and the new code was called IPAPSig. I have installed IPAP on the same machine and it works perfectly!

I thought perhaps that the signature code and 3rd (SigPlusNET) party dll might be the issue but the error messages are complaining about Infragistics not SigPlusNET.

thoughts?

thx in advance

Dave
0
Comment
Question by:nbkbar7
  • 5
  • 5
10 Comments
 
LVL 13

Expert Comment

by:LIONKING
ID: 38298002
Are you creating the Deployment Package from Visual Studio?
If you are, you should include all dependencies and register them in the GAC of the target machine. This link explains how to do it: http://stackoverflow.com/questions/1889906/registering-dlls-in-the-gac-using-visual-studio-installer
0
 
LVL 6

Author Comment

by:nbkbar7
ID: 38298120
No actually I am dropping everything into a shared subdir and copying it into a dir on the virtual machine.
0
 
LVL 13

Expert Comment

by:LIONKING
ID: 38298159
So you want to run this with Visual Studio? Or do you want to simulate how it will run once you install it?
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 6

Author Comment

by:nbkbar7
ID: 38298214
I created an application. I made a copy of the application code and created a second application. In the second application I added some features. Both applications run perfectly on my DEV machine. Only the first one runs on the XP machine.

This has nothing to do with installing. It only has to do with running the applications.
0
 
LVL 13

Expert Comment

by:LIONKING
ID: 38298221
If you move the application to another machine and plan to run it from VS, you should add the assembly to the GAC in the new machine (which you already did) and then add the reference again to the project in VS.

Give this a try and let us know.
0
 
LVL 6

Author Comment

by:nbkbar7
ID: 38298268
I'm confused I guess. I'm not running the app from VS. It's a standalone application. I'm not sure how to clarify further. I wrote IPAP.exe and IPAPSig.exe and I copied them over to another machine. IPAP.exe works and IPAPSig.exe gives the above errors.

make sense?
0
 
LVL 13

Expert Comment

by:LIONKING
ID: 38298543
I doubt that's gonna work, because of the versioning in the gac. Your application must have the exact version (not the dll version, but the assembly version in the gac) is this isn't the same the application will not recognize the assembly.

On the other hand if you copy the dll files to the new computer it still won't work because the reference is pointing to the gac. So I think you have two options:

a. Create an install package in the dev box and install the app in the new box.

b. Add the reference to the physical (not through the gac) file and copy the entire bin folder to the new box and it should run.
0
 
LVL 6

Author Comment

by:nbkbar7
ID: 38298679
Clearly you are not understanding my problem. If you have any input related to my problem I would appreciate it.
0
 
LVL 13

Accepted Solution

by:
LIONKING earned 2000 total points
ID: 38300361
I'm sorry if my last post was not clear. Here is some information regarding the GAC and the deployment methods that "should" be used. Source: CodeProject

- A key point to note here is that once your application installs Assemblies in the GAC, it loses the benefits of XCOPY deployment as these assemblies (other than the .NET System Libraries) must be explicitly installed in the GAC.

- It is important to understand the concept of Identity as it pertains to a .NET Assembly. An Assembly’s identity includes its simple textual name, a version number, an optional culture if the assembly contains localized resources, and an optional public key used to guarantee name uniqueness and to protect the name from unwanted reuse (name spoofing). An assembly with a simple Identity includes just the mandatory simple textual name and version number components. Since the GAC is the machine-wide repository for shared assemblies, it is very easy to run into the problem of name collisions if these assemblies only had simple identities because they are developed independently by different vendors and even developers within your own organization. Hence it is mandatory that every shared assembly installed in the GAC have a Strong Name. The formal definition of the term in the online documentation is

A strong name consists of the assembly's identity — its simple text name, version number, and culture information (if provided) — plus a public key and a digital signature. It is generated from an assembly file (the file that contains the assembly manifest, which in turn contains the names and hashes of all the files that make up the assembly), using the corresponding private key.

- Developers of Windows Installer packages can install assemblies to the GAC using Microsoft Windows Installer 2.0. This is the preferred way for installing such shared assemblies and should be the only way shared assemblies are installed on non development machines.

Like I said, in order for these programs to work, not only do the files must have the same names and versions (in the GAC), they also need the same Public Key Token and Digital Signature(as stated above) because all this is what identifies an assembly in the GAC. That's what I meant when I said version in the GAC in my previous post.

You can always check these properties navigating to C:\Windows\Assembly and right click + Properties on the file... If any of these properties is different in your target machine and your dev machine the application will not find the file.

According to a post on the same forum you could change the reference of your project by altering the app configuration file and pointing it to the correct key that is registered in the GAC.

Hope this gives you a hint of how the GAC works and how the referencing works when you use assemblies that are stored in the GAC.

Regards.
0
 
LVL 6

Author Closing Comment

by:nbkbar7
ID: 38300494
The problem was another 3rd party dll was not the version that IPAPSig was compiled with. What that dll has to do with the one in the error message I don't know. But everything is working now.

Thanx for your effort and perserverance your last post jogged my memory and I went through and checked all my version numbers.

Thx LIONKING!


D
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question