Project Description
The absence of tools in Visual Studio that can help developers to create Vista gadgets is strange and disappointing, in my opinion. I hope it's a temporary state, but now, I want to show you some tools that can help you to develop Vista gadgets using only Visual Studio 2008 or 2010 IDE. These tools include Visual Studio template for creating Vista gadgets and Visual Studio add-in for creating a .gadget file from a project and run a gadget installation.

By now, if we want to create a Vista gadget, we should following next steps:

  1. Create all needed folders and important files in some folder.
  2. Create a zip archive within all folders and files that should be included in the gadget.
  3. Change the extension from .zip to .gadget for the archived files.
  4. Run this file by double clicking for starting the process of gadget installation.

  All this action could be executed from the Windows Explorer. If you will create a gadget for a company which inner policy will require that all assemblies and executed files have to be signed  you will be engaged into using cabarc.exe and signtool.exe for signing your gadget. It’s a really boring task to create a signed gadget without any automation.

  So, how we can automate all these steps using Visual Studio IDE?

 The answer you can find out here and it's the add-in that was created for helping in development Vista gadget. With this add-in you can easily build signed and unsigned gadget using only one click on menu item or toolbar button or using shortcuts(Ctrl+R, Ctrl + R this combination can be changed). So, how to install it? For this issue I've prepared some installation pack. Below I describe how to install all these stuff. 

In the installation pack I have prepared:

  1. AddinDeployment.vsi  - Visual Studio add-in installation file.
  2. CSharpHelloVistaGadgetTemplateDeployment.vsi  and VBHelloVistaGadgetTemplateDeployment.vsi files – Sample Visual Studio gadget  templates for C# and VB.NET. Really they don’t depend on which language you will install a template, because a gadget requires only javascript and vbscript as programming languages. So, here only one difference – for which language you will use template, no more.  
  3. cabarc.exe and signtool.exe – Additional program that will require add-in for running. You can set path for existed applications if they have already installed on your computer. Later I will explain how. So, if you have already installed these applications you can delete each one from your computer.  

  So, when you are already have installed add-in and some templates you should define some important options for your future gadget development. For this issue you should open add-in settings window and define some parameters. 

  Choose from menu Gadget -> Open gadget properties window or choose corresponding appropriate button from the toolbar.  


 Then you should see the next window. 



In this window you should define:

  1. Output Vista Gadget Path – a path where add-in will save your gadget after it have been created.
  2. Cabarc.exe path – cabarc.exe is an application which will create your gadget file. So, it’s extremely important to define here the right path to this application. Official page where you can find this utility is: Moreover I already prepared this utility for you in this installation pack. So, you can choose a path where you will place an installation for this article.
  3. Allowed file extensions - this is a collection of file extensions that define types of files which you wish to place into your gadget.
  4. If you are going to sign your gadget you should:

3.1      Mark checkbox “Is will build signed gadget”

3.2      Define core signtool.exe utility path for this action. You can find more about this utility here -

3.3      If you have ready to use .pfx file (personal information exchange file) define path to it.

3.4      If you haven’t .pfx file but you have .pvk and one from .spc or .cer files you can make new .pfx file using pvk2pfk.exe utility. You can find more about this utility here -

3.5       Define also password for your .pfx file. 


 After you have completed entering all needed information click button "Save" for saving these options.

 Also I want to noticed that extremly important here is that your project was placed on the same logical  disk as cabarc.exe  and signtool.exe. This is restriction for Microsoft console applications that was mentioned above. So, you should be careful and place these utilities strictly on the same logical disk as for the project that you are working on. 

 Congratulations! Now you are ready to use addin from your Visual Studio 2008 IDE.

When you already complete installation process you are ready for creating your own gadget with Visual Studio IDE. In this case you should open menu item: File -> Open -> Web site.
After this you can find new open window where you can choose HelloWorldVistaGadget template. 


 When you click on this template Visual Studio is opened new web site which structure would resemble real gadget project structure as you can see on the picture.


 Here you can find only one foreign element - it's a web.config file. But if you are going to build gadget using RunVistaGadgetAddIn it is not an obstacle, because add-in will not include this file to output .gadget file.

 Here I will not tell you about how to create a gadget. You can find more sources with good explanation of this process rather here on CodeProject or read grateful book about this issue.

 I'm just noticed that after creating your beutiful gadget in Visual Studio you can just click on the button "Run gadget" or use shortcut Ctrl+R, Ctrl+R and you can see your gadget in the beforehand place. Moreover add-in will run gadget installation process and you should only click on "Install" button in the gadget installation dialog (you can see it on the picture) for observing your gadget on sidebar.


 By now after clicking on "Run gadget" button you are always should see this window that suggest you to install gadget on the Windows sidebar. But I'm discovered some problem with this scenario when gadget have used settings option in its code. You can have had a problem with installing gadget on sidebar in this case after first installation. Really it's not a problem, just you should twice repeate installation process. I'm personally trying to find out the reason for such behavior, but could only reveal that the Windows Sidebar has held some gadget files opened and hadn't clear resources after closing gadget on the sidebar. So, if you find out how to resolve this issue let me know, please!

 If you have felt that this add-in not satisfied your needs you can switch off this add-in. You should choose menu item Tools -> Add-in manager. And in the appeared window remove a tick from this add-in. In this case this add-in will not disturb you anymore.



Last edited Nov 20, 2010 at 8:38 PM by a_pros, version 2