Cannot use NetOffice with .NET 4.5.1 application

Aug 6, 2015 at 4:12 PM
Hi,
We have an application which used .NET 3.5 and not we are going to update it to 4.5.1. NetOffice version we have is 1.5.1.2. I just downloaded new version from here and cannot build the application.
Below is error message:
Error 17 Interop type 'NetOffice.ExcelApi.Application' cannot be embedded. Use the applicable interface instead.

This is the line where error points to
using ExcelApplication = NetOffice.ExcelApi.Application;
and few lines where we use it:
version = Application.ProductVersion;
public static ExcelApplication CreateExcelApplication()
        {
            var application = new ExcelApplication();

            application.Visible = false;
            application.ScreenUpdating = false; // performance speed-up
            application.DisplayAlerts = false;

            return application;
        }
Coordinator
Aug 6, 2015 at 6:43 PM
its a reference problem.
go to rerefence options set the Option "Embed Interop Types" to false.

*Sebastian
Aug 7, 2015 at 10:19 AM
Hi Sebastian,
Thanks for reply.
It is already set to False
Image
Coordinator
Aug 7, 2015 at 10:31 AM
you have to set this setting for each individual NetOffice (assembly) reference.
in your case: ExcelApi.dll cause problems here.

in other words: use this settings for all NetOffice (assemblies) references you know.

NetOffice contains multiple assemblies.
Set all reference settings here to "Embed Interop Types:false" and everything is okay.
(i'm sry visual studio is very stupid here)

*Sebastian
Aug 7, 2015 at 10:33 AM
Yeah, got these all set, there are 2 more assemblies included.
Now everything compiles.
Thank you very much.