Solved

Crash at runtime

Posted on 2003-11-10
12
740 Views
Last Modified: 2012-06-27
I have just tried to deploy a very small console program onto my live server and of course it crashed at run time. :( IT compiled fin on the live server.

Basically the program that works fine on my development computer opens word documents reads them and then inserts then into a database. My program references The Office XP Primary Interop Assemblies that interacts with the word object libraries.

Here is what i think is the problem.

On my development computer everything is on the same drive.
On the live server the .net framework is on the c: drive and word and my program (which includes the necessary Office XP PIA files) are on the D: drive I think the drive difference is the problem i'm trying to replicate the live server but i have very little resources at work and not much help. I have also got limited access to the live server.

the error that comes up is:

Unhandled Exception: System.IO.FileNotFoundException: File or assembly name Micr

osoft.Office.Interop.Word, or one of its dependencies, was not found.

File name: "Microsoft.Office.Interop.Word"

  at CVU.Components.Cv.ReadWordToMemory(String filename)

  at CVU.Cvs.GetCvInfo(FileInfo[] filenames)

  at CVU.MainClass.UploadCvs()

  at CVU.MainClass.Main(String[] args)


CVU is the name of my program.


any help would be fantastic.

cheers apb
0
Comment
Question by:apb2
  • 7
  • 2
  • 2
  • +1
12 Comments
 
LVL 1

Expert Comment

by:brabchev
ID: 9714147
Do you have Office XP installed on the live server?
0
 
LVL 6

Author Comment

by:apb2
ID: 9714163
yeah office xp sbe which is istalled on the d: drive
0
 
LVL 1

Expert Comment

by:brabchev
ID: 9714228
The reason can’t be the drive difference, because the word libraries are registered.
Are Office XP PIA files and your assembly in the same directory?
0
 
LVL 6

Author Comment

by:apb2
ID: 9714259
Basically i have put the Office XP PIA's in a subfolder in my program and then reference then in a setup.bat file that compiles the program on the live server. Then the person who administers the live server didn't have to mess around with the assemblies. It worked on my laptop and development server.

0
 
LVL 2

Expert Comment

by:sedmans
ID: 9714699
Putting the Office XP PIA's in the GAC should solve this problem.

You can also create a config file for your application and add a probing node.
0
 
LVL 6

Author Comment

by:apb2
ID: 9714864
i will try this, i'm setting up a server here at work that will replicate the settings on the live box.

But i give that a go and tell you how it goes.

cheers
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Assisted Solution

by:ptmcomp
ptmcomp earned 250 total points
ID: 9716505
Copy the Microsoft.Office.Interop.Word.dll in the same folder as your other executables. The interop assembly should then use the registry to locate the COM-object. (Else you would have to place the assembly in the global assembly cache wich causes many troubles with updates and patches.)
0
 
LVL 6

Author Comment

by:apb2
ID: 9731406
one final question

do you have to register the Microsoft.Office.Interop.Word.dll ??

i.e.

regedit /s Microsoft.Office.Interop.Word.dll.reg

Because i didn't register it last time even though i included both the woord interop asseblies, whould this of caused it to crash.

I assumed the PIA's where managed code and hence didn't need to be registered.
0
 
LVL 2

Accepted Solution

by:
sedmans earned 228 total points
ID: 9731470
You are correct.  PIA's are managed code and as such you do not need to register them
0
 
LVL 6

Author Comment

by:apb2
ID: 9731561
crap, well i'm testing the program tomorrow. We'll see it works.

That's strange because when you add the PIA'a to tha GAC the setup file also registers them.

fingers crossed. If it works tomorrow i'll administer the points. if not :'(

cheers

apb
0
 
LVL 6

Author Comment

by:apb2
ID: 9731579
i sent them a test program which they ran this morning and the setup file registered the PIA and i included the PIA in the same directory as the test program, it all worked fine. So i'm pretty positive it should work.

basically all the program did was display what version of word object was on the server.

fingers crossed.

apb2
0
 
LVL 6

Author Comment

by:apb2
ID: 9738316
Well it worked thanks for your help.

cheers
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

930 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now