Solved

Crash at runtime

Posted on 2003-11-10
12
737 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

12 Experts available now in Live!

Get 1:1 Help Now