Broken References

B

Bill Schanks

I created an Excel Automation Windows Application (VB.Net 2003) and it
works on the development machine fine.

However when I run it on another machine I get this error:

System.IO.FileNotFoundException: File or assembly name
Microsoft.Office.Interop.Excel, or one of its dependencies, was not
found.

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

Both machines have Excel 2003 installed, and I have a reference set to
Excel 11.0.
 
A

Armin Zingler

Bill Schanks said:
I created an Excel Automation Windows Application (VB.Net 2003) and
it works on the development machine fine.

However when I run it on another machine I get this error:

System.IO.FileNotFoundException: File or assembly name
Microsoft.Office.Interop.Excel, or one of its dependencies, was not
found.

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

Both machines have Excel 2003 installed, and I have a reference set
to Excel 11.0.


Is the file mentioned there?

I've never done it and didn't read it completely, but this might help:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_oxppias.asp

If not, search for "PIA" (primary interop assemblies) and "deploy".


Armin
 
B

Bill Schanks

It seems like too much to have the end users having to install the PIA.

In my project I don't have 'Imports Microsoft.Office.Core'. I just have
a reference set to Excel 11.0. I will add it to see if that solves the
problem.

What started me on this project was some sample code from MS on excel
automation. In there the code was:

dim xlApp as new excel.application

I had to make it:

dim xlApp as new Microsoft.Office.Interop.Excel.Application().

Shouldn't excel.application work? I'm fine using the fully qualified
name it just seems like sample code should work once the references are
correctly set.
 
A

Armin Zingler

Bill Schanks said:
It seems like too much to have the end users having to install the
PIA.

You're using them in the project, thus you will need them. (maybe there are
exceptions I haven't heard of (see
microsoft.public.dotnet.framework.interop))
In my project I don't have 'Imports Microsoft.Office.Core'. I just
have a reference set to Excel 11.0. I will add it to see if that
solves the problem.

Importing a namespace doesn't solve it. It only saves you from typing the
full qualified name in the code.
What started me on this project was some sample code from MS on
excel automation. In there the code was:

dim xlApp as new excel.application

I had to make it:

dim xlApp as new Microsoft.Office.Interop.Excel.Application().

Shouldn't excel.application work? I'm fine using the fully qualified
name it just seems like sample code should work once the references
are correctly set.

If you import Microsoft.Office.Interop at project level or file level, you
don't have to type the FQN. That's what they probably assumed in the sample
code.


Armin
 
S

Stan Smith

in message
I created an Excel Automation Windows Application (VB.Net 2003) and it
works on the development machine fine.

However when I run it on another machine I get this error:

System.IO.FileNotFoundException: File or assembly name
Microsoft.Office.Interop.Excel, or one of its dependencies, was not
found.

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

Both machines have Excel 2003 installed, and I have a reference set to
Excel 11.0.

Bill,

I think you just need to put the file interop.excel.dll in the same folder
with your executable. That's probably the file that is missing.

You can rewrite the program to use late binding and then it wouldn't be
necessary.

Stan

--
Stan Smith
ADS Programming Services
Birmingham, AL
205-222-1661
ssmith_at_adsprogramming.com
 
A

Armin Zingler

Stan Smith said:
I think you just need to put the file interop.excel.dll in the same
folder with your executable. That's probably the file that is
missing.


He doesn't want to install the interop PIA. ("It seems like too much to have
the end users having to install the PIA.") I wrote that this is necessary to
run the app.


Armin
 
B

Bill Schanks

Thanks everyone for the help, sorry for the noob questions. I am maily
a vba programmer and I am making the switch to vb.net so I can write
stand alone apps.

I created an installer and it copies the proper .dll files. There is no
need to install the PIA's if the proper .dll file is in the same
directory as the application.

Thanks again for the guidance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top