Solved

Crash at runtime

Posted on 2003-11-10
12
760 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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
 
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

617 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