DEV Community

AsposeDiagram
AsposeDiagram

Posted on • Updated on

Install Aspose.Diagram using NuGet and Create Microsoft Visio Document in Visual Studio

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.

Supported Platforms

Aspose.Diagram supports both .NET and Java platforms. Please see Aspose.Diagram for .NET and Aspose.Diagram for Java for your reference.

Article Description

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.

Snapshot of Aspose.Diagram NuGet Download Link.

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.

Open Visual Studio 2017 or any other.

  • Click New > Project.

Click New > Project.

  • Select Console App (.NET Framework) and give it name TestAsposeDiagram and then click OK.

Select Console App (.NET Framework) and give it name TestAsposeDiagram.

  • Console Application Project named TestAsposeDiagram will be created in Visual Studio.

TestAsposeDiagram console application project created.

Install Aspose.Diagram using NuGet Pacakage Manager

  • Right click the project inside the Solution Explorer and click Manage NuGet Packages…

Click Manage NuGet Packages inside the Solution Explorer.

  • Click Browse, type Aspose.Diagram, you will see Aspose.Diagram listed, select it and click Install button.

Click Install button when Aspose.Diagram is listed in the NuGet Packages.

  • Preview Changes dialog box will appear. Click OK.

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.

License Acceptance dialog box appears, please view and accept the license of Aspose.Diagram.

  • NuGet Pacakage Manager installs Aspose.Diagram and shows the progress information in Output window.

NuGet Package Manager installs Aspose.Diagram and shows progress in Output window.

  • On viewing References in Solution Explorer, you will find, Aspose.Diagram is present there as shown in this screenshot.

Aspose.Diagram is present inside References in Solution Explorer.

  • Hover your mouse pointer on Path inside the Aspose.Diagram Reference Properties to find the path of DLL and check the Version number.

Path and Version of Aspose.Diagram shown inside assembly Properties inside the Solution Explorer.

  • 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.

View packages.config file that displays the Aspose.Diagram NuGet package and its version.

Create Microsoft Visio Document using Aspose.Diagram

  • Please first add the following C# Using Directive.
using Aspose.Diagram;
  • 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.

Sample Code to Create Microsoft Visio Document using Aspose.Diagram.

Output Microsoft Visio Document using Aspose.Diagram

OutputByAsposeDiagram.vsdx created by Aspose.Diagram.

  • 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.

Output VSDX created by Aspose.Diagram showing the Evaluation Warning message.

See also

Top comments (0)