This project has moved. For the latest updates, please go here.

Message "ref to class not allowed....no-PIA mode"

Apr 13, 2016 at 10:24 AM
Edited Apr 13, 2016 at 10:40 AM
I'm using VB.net with NetOffice 4.5 dlls
Visual studio gives the error message
Reference to class "Application" is not allowed when its assembly is linked using No-PIA mode"
The error is also flagged for Workbook" and "Worksheet" references

The ddl's are in my bin/debug folder and I have added references to the project, and the Imports are OK
Imports NetOffice.Tools
Imports NetOffice.ExcelApi.Tools
Imports excel = NetOffice.ExcelApi

Also
excelApp = New excel.Application
I get "Interop type 'Application' cannot be embedded. Use the applicable interface instead."

How do I get round this?

Is there a sample project in VB.net?
Coordinator
Apr 13, 2016 at 10:42 AM
hey men,

this is a well known problem because Visual Studio is a bit more "intelligent" here as we need.

please go to the project options and to the reference settings.
select each NetOffice assembly and please disable the reference option "Embedd Interop Types" (FALSE)
and now, NetOffice is no longer in PIA mode(means:=works fine)

(this is a short explaination because the most people dont care for what happen behind the scences. please let me know if you need any further description)

XL_REGARDS
*Sebastian
Apr 13, 2016 at 1:18 PM
Many thanks for a quick response and a great bit of code.