4
votes

After adding the interop.excel reference to my C# winform in Visual Studio, I am no longer able to "Edit and Continue"....
error says "Modifying a 'method' which contains a usage of an embedded interop type/member will prevent the debug session from continuing while Edit and Continue is enabled. To enable Edit and Continue, try setting "Embed Interop Types" property to "False" for COM references when debugging"

Unfortunately, when I set the "Embed Interop Types" property to "False", VS gives me errors for the following code:
ws.Cells[2, 1].Value = xxx;
Error says "'object' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)"

Ive looked all over SO for the answer with no luck...is there someone out there who can help?

1
The type of that property is dynamic, not object. You did something else than just changing the Embed Interop Types property. Probably because you forgot to also set the Copy Local property to true. Don't make us guess, please.Hans Passant

1 Answers

1
votes

Cells() does not have the property Value (Range() has it)
change this line to ws.Cells[2, 1]= xxx;