Thursday, 15 September 2011

c# - Excel dynamic operations can only be performed in homogenous appdomain error -



c# - Excel dynamic operations can only be performed in homogenous appdomain error -

the company work has alternative create plugins our main product. working on plugin. plugin needs read in excel file.

part of plugin tries worksheet name:

excel.application excelapp = new excel.application(); excel.workbook wb = excelapp.workbooks.open(filename, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing); excel.worksheet ws = wb.sheets[sheetname] excel.worksheet;

when run standalone application (outside of our main application) above code works fine.

however when run above code plugin our main application next execption:

dynamic operations can performed in homogenous appdomain

i have done research , found legacy security policy related. other reasons unaware of , cannot alter our main product must run legacy security policy turned on.

<netfx40_legacysecuritypolicy enabled="true"/>

regardless of status our client still wants feature added. there must way of getting excel functionality work.

c# .net excel

No comments:

Post a Comment