I am attempting to add some text in the layout view of ArcMap. I’m using the following line for the TextElement that I’ve found online from numerous places including ArcObjects Library Reference. Being new to ArcObjects, I'm not sure if I'm doing something wrong or if there is something else going on that I'm unaware of.

ITextElement textElement = new TextElementClass(); 

I’m receiving the following errors:

The type TextElementClass has no constructors defined
Interop type TextElementClass cannot be embedded. 

Full Code:

protected override void OnClick()
        IMxDocument mxDoc = ArcMap.Application.Document as IMxDocument;
        IMap map = mxDoc.FocusMap;
        IActiveView activeView = map as IActiveView;
        IPageLayout pageLayout = activeView as IPageLayout;

        if (activeView is IPageLayout)
            IGraphicsContainer graphContainer = pageLayout as IGraphicsContainer;
            ITextElement textElement = new TextElementClass(); 
            textElement.Text = "Test";
            IElement element = textElement as IElement;
            MessageBox.Show("This tool only functions in layout view");
  • I'm using "ITextElement pTextElement = new TextElementClass();" without issue, so it must be somehow related to the config, license or assemblies.
    – patrick
    Oct 31, 2013 at 16:37

1 Answer 1


Make sure that all the ESRI interop assemblies (ESRI.ArcGIS.*) your project references have the "Embed Interop Types" flag set to false.

You can do this by selecting the reference in the Visual Studio Solution Explorer window and changing the flag in the Properties window.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.