> For the complete documentation index, see [llms.txt](https://saveenr.gitbook.io/visio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://saveenr.gitbook.io/visio/visio-csharp/visio-and-csharp/hello-world.md).

# Hello world

### Add a reference to the Visio Primary Interop Assembly:

* In the Solution Explorer, right click on References, select Add Reference
* The Add Reference dialog will launch
* In the .NET Tab select Microsoft.Office.Interop.Visio
* Click OK

### Code

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using IVisio = Microsoft.Office.Interop.Visio;
namespace Visio2007AutomationHelloWorldCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var visapp = new IVisio.Application();
            var doc = visapp.Documents.Add("");
            var page = visapp.ActivePage;
            var shape = page.DrawRectangle(1, 1, 5, 4);
            shape.Text = "Hello World";
        }
    }
}


// Add a new empty doc
var 
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://saveenr.gitbook.io/visio/visio-csharp/visio-and-csharp/hello-world.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
