# Trouble compiling C# application



## jadavila (Sep 12, 2006)

I have an application that is attempting to read an excel spreadsheet. It is a .net application written in visual studio 2003. I added a reference to a com object.
I wrote the code but get the following error.

Warning: The dependency 'Interop.Microsoft.Office.Core, Version=2.3.0.0, Culture=neutral' in project 'ErateInvTrack' cannot be copied to the run directory because it would overwrite the reference 'Interop.Microsoft.Office.Core, Version=2.2.0.0, Culture=neutral'.

I would like some help in fixing this problem.


----------



## dquigley (Apr 17, 2006)

Visual Studio is trying to overwright a created COM interop dll. You may be referencing more than one version of an Office Core COM object or you changed references and didn't do a clean build

Dan


----------



## jadavila (Sep 12, 2006)

I am including another persons objects in my solution. I was told that excel (the office product I am trying to use) is already in the objects in a wrapper. How do I find out which object the excel is already in?


----------



## welmann (Sep 27, 2006)

.NET is great but in interfacing with COM stuff its suffers an achilles heal of COM interop.

Until(!!) MS releases a .NET library for its office stuff we are stuck with this solution. Your build has got itself in a bit of a knot, and as mentioned in an earlier reply you need to do a full clean rebuild.

1) Close the entire project and delete entirely the bin and obj folders in the project directory

2) Open the projects, remove and re-add all your office/ excel etc references, making sure you choose the right version (10 probably)

Do a full rebuild of the solution


----------

