This project has moved and is read-only. For the latest updates, please go here.

Cannot use NetOffice with .NET 4.5.1 application

Aug 6, 2015 at 5:12 PM
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 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;
Aug 6, 2015 at 7:43 PM
its a reference problem.
go to rerefence options set the Option "Embed Interop Types" to false.

Aug 7, 2015 at 11:19 AM
Hi Sebastian,
Thanks for reply.
It is already set to False
Aug 7, 2015 at 11: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)

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