[GIS] Issue with initializing ArcObjects Interface and classes

add-inarcgis-10.2arcobjectsnet

I was going through ArcObjects example on following linkWalkthrough_Building_custom_UI_elements .I followed same steps but I was getting error while initializing objects for following code.

ESRI.ArcGIS.Display.IRubberBand rubberBand = new ESRI.ArcGIS.Display.RubberLineClass()
ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass()
IMarkerElement markerElement = new MarkerElementClass()

etc I was not able to find exact reason why I was getting but may be due to version of ArcObjects.I am using .Net 4.0,Visual studio 2010, ArcObjects 10.2.
I got following type of error

The type 'ESRI.ArcGIS.Display.RubberLineClass' has no constructors defined.
Interop type 'ESRI.ArcGIS.Display.SimpleMarkerSymbolClass' cannot be embedded. Use the applicable interface instead.

Best Answer

I had this problem in Visual Studio 2010, when you included your error message it came back to me. The answer can be found here : https://stackoverflow.com/questions/2483659/interop-type-cannot-be-embedded.

Extract of:

For whatever reason, this assembly can't be embedded - but it sounds like that's not a problem for you. Just open the Properties tab for the assembly in Visual Studio 2010 and set "Embed Interop Types" to "False".

Related Question