Aspose.Diagram API helps developers to work with Microsoft Visio files. They can create, manipulate and convert Visio file formats in their applications without any need to install Microsoft Visio. Aspose.Diagram is a light-weight API and suitable for both client side and server side use. The API is extensible, easy to use, compact and provides common functionality so that developers have to write less code when performing common tasks.
In this article, we will install Aspose.Diagram using NuGet and create a Microsoft Visio document using it in Visual Studio.
Aspose.Diagram NuGet Download Link
You can always find the most recent version or earlier versions of Aspose.Diagram from the following NuGet link. Please see its snapshot given below.
Install Aspose.Diagram using NuGet Pacakage Manager in Visual Studio
In this section, we will create a console application project and install Aspose.Diagram using NuGet Package Manager. We will illustrate all the steps involved with screenshots for your ease.
Create Console Application Project
- Open Visual Studio. The following screenshot shows Visual Studio 2017 but you can use any Visual Studio.
- Click New > Project.
- Select Console App (.NET Framework) and give it name TestAsposeDiagram and then click OK.
- Console Application Project named TestAsposeDiagram will be created in Visual Studio.
Install Aspose.Diagram using NuGet Pacakage Manager
- Right click the project inside the Solution Explorer and click Manage NuGet Packages…
- Click Browse, type Aspose.Diagram, you will see Aspose.Diagram listed, select it and click Install button.
- Preview Changes dialog box will appear. Click OK.
- License Acceptance dialog box will appear. You can view the license and accept it to proceed further.
- NuGet Pacakage Manager installs Aspose.Diagram and shows the progress information in Output window.
- On viewing References in Solution Explorer, you will find, Aspose.Diagram is present there as shown in this screenshot.
- Hover your mouse pointer on Path inside the Aspose.Diagram Reference Properties to find the path of DLL and check the Version number.
- View packages.config file that displays the Aspose.Diagram NuGet package and its version. You can modify it later on to try other versions of Aspose.Diagram.
Create Microsoft Visio Document using Aspose.Diagram
- Please first add the following C# Using Directive.
- Now add the following C# code in the Main method and then press F5 or Ctrl + F5 to run it.
The code creates object of Aspose.Diagram.Diagram class and just saves it as OutputByAsposeDiagram.vsdx. Please note, VSDX is the Microsoft Visio format that represents XOPC/XML drawing.
- The following screenshot shows the Complete Sample Code inside the Visual Studio Console Application Project for your reference.
Output Microsoft Visio Document using Aspose.Diagram
- After the successful execution of the code, OutputByAsposeDiagram.vsdx document will be created inside the output directory.
- Double click the OutputByAsposeDiagram.vsdx to open it in Microsoft Visio.
As you can see in screenshot, the output Microsoft Visio document is empty and only showing Evaluation Warning message. It is because we have not set license for Aspose.Diagram. Once, you will set the license, this warning will disappear. Please see the document Aspose.Diagram Licensing for more information about it.