Walkthrough: Creating an SDK using C# or Visual Basic
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Walkthrough: Creating an SDK using C# or Visual Basic.
In this walkthrough, you’ll learn how to create a simple Math Library SDK by using Visual C# and then package the SDK as a Visual Studio Extension (VSIX). You’ll complete the following procedures:
To follow this walkthrough, you must install the Visual Studio SDK. For more information, see Visual Studio SDK.
On the menu bar, choose File, New, New Project.
In the list of templates, expand Visual C# or Visual Basic, choose the Windows Store node, and then choose the Windows Runtime Component template.
In the Name box, specify SimpleMath, and then choose the OK button.
In Solution Explorer, open the shortcut menu for the SimpleMath project node, and then choose Properties.
Rename Class1.cs to Arithmetic.cs and update it to match the following code:
In Solution Explorer, open the shortcut menu for the Solution 'SimpleMath' node, and then choose Configuration Manager.
The Configuration Manager dialog box opens.
In the Active solution configuration list, choose Release.
In the Configuration column, verify that SimpleMath row is set to Release, and then choose the Close button to accept the change.
Important The SDK for the SimpleMath component includes only one configuration. This configuration must be the release build, or apps that use the component won't pass certification for theWindows Store.
In Solution Explorer, open the shortcut menu for the SimpleMath project node, and then choose Build.
On the shortcut menu for the Solution ‘SimpleMath’ node, choose Add, New Project.
In the list of templates, expand Visual C# or Visual Basic, choose the Extensibility node, and then choose the VSIX Project template.
In the Name box, specify SimpleMathVSIX, and then choose the OK button.
In Solution Explorer, choose the source.extension.vsixmanifest item.
On the menu bar, choose View, Code.
Replace the existing XML with the following XML:
In Solution Explorer, choose the SimpleMathVSIX project.
On the menu bar, choose Project, Add New Item.
In the list of Common Items, expand Data, and then choose XML File.
In the Name box, specify
SDKManifest.xml, and then choose the Add button.In Solution Explorer, open the shortcut menu for
SDKManifest.xml, choose Properties, and then change the value of the Include in VSIX property to True.Replace the contents of the file with the following XML:
In Solution Explorer, open the shortcut menu for the SimpleMathVSIX project, choose Add, and then choose New Folder.
Rename the folder to
references.Open the shortcut menu for the References folder, choose Add, and then choose New Folder.
Rename the subfolder to
commonconfiguration, create a subfolder within it, and name the subfolderneutral.Repeat the previous four steps, this time renaming the first folder to
redist.The project now contains the following folder structure:
references\commonconfiguration\neutral redist\commonconfiguration\neutral
In Solution Explorer, open the shortcut menu for the SimpleMath project, and then choose Open Folder in File Explorer.
In File Explorer, navigate to the bin\Release folder, open the shortcut menu for the SimpleMath.winmd file, and then choose Copy.
In Solution Explorer, paste the file into the references\commonconfiguration\neutral folder in the SimpleMathVSIX project.
Repeat the previous step, pasting the SimpleMath.pri file into the redist\commonconfiguration\neutral folder in the SimpleMathVSIX project.
In Solution Explorer, choose SimpleMath.winmd.
On the menu bar, choose View, Properties (Keyboard: Choose the F4 key).
In the Properties window, change the Build Action property to Content, and then change the Include in VSIX property to True.
In Solution Explorer, repeat this process for SimpleMath.pri.
In Solution Explorer, choose the SimpleMathVSIX project.
On the menu bar, choose Build, Build SimpleMathVSIX.
In Solution Explorer, open the shortcut menu for the SimpleMathVSIX project, and then choose Open Folder in File Explorer.
In File Explorer, navigate to \bin\Release folder, and then run SimpleMathVSIX.vsix to install it.
Choose the Install button, wait for the installation to finish, and then restart Visual Studio.
On the menu bar, choose File, New, New Project.
In the list of templates, expand Visual C# or Visual Basic, and then choose the Windows Store node.
Choose the Blank App template, name the project ArithmeticUI, and then choose the OK button.
In Solution Explorer, open the shortcut menu for the ArithmeticUI project, and then choose Add, Reference.
In the list of reference types, expand Windows, and then choose Extensions.
In the details pane, choose the Simple Math SDK extension.
Additional information about your SDK appears. You can choose the More Information link to open http://www.msdn.microsoft.com, as you specified in the SDKManifest.xml file earlier in this walkthrough.
In the Reference Manager dialog box, select the Simple Math SDK check box, and then choose the OK button.
On the menu bar, choose View, Object Browser.
In the Browse list, choose Simple Math.
You can now explore what’s in the SDK.
In Solution Explorer, open MainPage.xaml, and replace its contents with the following XAML:
Update MainPage.xaml.cs to match the following code:
Choose the F5 key to run the app.
In the app, enter any two numbers, choose an operation, and then choose the = button.
The correct result appears.
You have successfully created and used an Extension SDK.
Walkthrough: Creating an SDK using C++
Walkthrough: Creating an SDK using JavaScript
Creating a Software Development Kit