Because I have been seeing the occasional requests for C# sample code (via sites like StackOverflow), this week I explored how we can use NuGet to make live much simpler. So I've published a new NuGet package called VisioCSharpSamples.
First, install NuGet: http://nuget.org/
Second, create an simple C# project in Visual Studio 2010 or Visual Studio 2012. The screenshots below show Visual Studio 2012 RC. In this case, let's pick a simple console application.
If you examine the Solution Explorer, you'll see the expected result.
Now select Tools > Library Package Manager > Package Manager Console
One the console loads, ensure that the Package source is pointing to the official NuGet feed
Then type in the following:
You'll see that the latest version of the samples is installed
Let's look at the Solution Explorer to confirm what happened.
Notice that a reference to Microsoft.Office.Interop.Visio was added.
Also, there is a folder called VisioCSharpSamples that contains several C# code files.
Currently, there's a static class called Samples that contains some static methods. The simplest is called HelloWorld found in the HelloWorld.cs file.
Of course, you can now simply call HellWorld() from your program and quickly get started transforming this hello world into something more complex.
NuGet makes it easy to get libraries into your projects in either source or binary form
I've published a NuGet package called VisioCSharpSamples that contains some useful source code snippets
Suggestions for additional samples are welcome