Specifying a Product Name, Publisher Name and other properties for VSTO solutions (Saurabh Bhatia)

Many customers have requested how to specify options like a Product or Publisher Name for Office 2007 VSTO solutions deployed from Visual Studio 2008. However, you cannot specify these properties in the Visual Studio IDE. In this post, I will describe the various other options you have to specify these properties.

Specifically we will be looking at the following properties:

Product Name – This is what the VSTO solution will be called in the Programs and Features (Add Remove Programs Entry)

Publisher Name – The name of the Publisher as displayed in Programs and Features

Figure 1 : Programs and Features Dialog in Vista showing Product Name and Publisher Name

Friendly Name – This is the name of the VSTO solution as it is displayed in the Office Add-ins dialog, the same value is also used in the VSTO trust prompt. Usually this value should be the same as the Product Name.

Office Application Description – The description of the Office Add-in.

SupportURL – End Users can click on the product name on the Trust Prompt dialog and visit a custom website related to the Solution.

Figure 3 : VSTO Trust Prompt with Friendly Name and link to SupporURL

The easiest way to specify these properties is to modify the Deployment and Application manifests for the VSTO solution (.vsto and .dll.manifest files).

To specify the Product, Publisher and SupportURL properties

The product name, publisher name and support url properties can all be specified in the deployment manifest, the .vsto file that is generated after publishing the solution. You can open the deployment manifest in a text editor and change the <description> tag to include the properties you want to specify.

Start the Visual Studio command prompt and use mage.exe to resign the deployment manifest:

mage –sign deploymentmanifest.vsto –Certfile Certificate.pfx

Example:

mage –sign MyExcelAddin.vsto –CertFile MyCert.pfx

To specify Friendly Name and Office Application Description:

The Friendly Name and Office Application Description properties can be found in the application manifest under the VSTOV3 namespace.

The application manifest (the MySolution.dll.manifest file) will typically be found under the Application Files\MySolution_X_X_X_X\ folder where the X’s describe the latest published version of the solution.

After you have changed the application manifest, you need to re-sign the application manifest itself. In addition you will also need to refresh the deployment manifest so that it has the new hash for the application manifest. Lastly you need to re-sign the deployment manifest.

The three steps after editing the application manifest can be performed using mage:

Your VSTO solution will now have these properties. The downside of this approach is that you will have to perform these manual steps after every publish. If you want to avoid these manual steps, you can make some changes to the VSTO build targets such that these properties are picked up by Visual Studio during publish. The general idea is that you can specify these properties in your Visual Studio project file (the .vbproj or .csproj) which will in turn be picked up by the build tasks so that they are automatically inserted into the manifest for every publish.

Changing your targets file is a risky scenario; if you change something incorrectly, none of your projects will build. So to be safe, the first thing you should do is make backups of the files that you are going to change.

Also to be safe, we will not be editing the main target file but a copy of it. Any VSTO project that you want to specify the publish properties for will use this new modified targets file.

One more thing to consider before modifying the targets file is that your project may not build correctly if you use the modified targets file and later update the Visual Studio version. If you update Visual Studio, you will have to make the corresponding changes in the new Visual Studio targets file.

Creating a backup and modifying the targets file

The file we will be modifying is: Microsoft.VisualStudio.Tools.Office.Office2007.targets,which can be found in the following directory: %ProgramFiles%\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools

To open the targets file

Create a backup. Copy the file to a safe location (cannot emphasize this enough).

Create another copy that you will be editing.

Create a copy of the file and save it to your Visual Studio 2008 folder under Documents. On Vista : C:\Users\username\Documents\Visual Studio 2008 On XP: C:\My Documents\Visual Studio 2008

Rename the filename to : Microsoft.VisualStudio.Tools.Office.Office2007_Properties.targets

You will be modifying this file for the remaining steps.

3. Open the Microsoft.VisualStudio.Tools.Office.Office2007_Properties.targets file in your favorite text editor.

To change the targets file to support Product Name

In this example, we treat Friendly Name to be the same as Product Name.

Find the comment for Add-in Options section: <!– Add-In options –> The comment is usually followed by the LoadBehavior tag: <LoadBehavior>3</LoadBehavior>

Find all instances of FriendlyName. Usually the FriendlyName is assigned to $TargetName: FriendlyName=”$(TargetName)” Change all instances to: FriendlyName = “$(ProductName)” There will be three places in all where you need to update FriendlyName.

You will find a line as follows: <OfficeApplicationDescription Condition=”‘$(VSTO_ProjectType)’ == ‘Application'”>$(TargetName) – $(OfficeApplication) add-in created with Visual Studio Tools for Office</OfficeApplicationDescription>

The very next line after this also needs to be modified: <OfficeApplicationDescription Condition=”‘$(VSTO_ProjectType)’ == ‘Document'”>$(TargetName) – $(OfficeApplication) document created with Visual Studio Tools for Office</OfficeApplicationDescription>

You are done modifying the targets file. The next step is to modify your project file and specify values for these properties. You will have to modify any project that you want to specify these properties for. The Visual Studio projects file is the .vbproj or .csproj file associated with your project. You can open up this file in a text editor.

You will have to modify the project so that it starts using the new targets file which you have created:

Modify project to use new target file

Find the following comment in the projects file: <!– Include additional build rules for an Office application add-in. –>

Replace the existing pointer to the targets file: <Import Project=”$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.Office2007.targets” /> With the path to the new targets file: <Import Project=”c:\users\username\documents\Visual Studio 2008\ Microsoft.VisualStudio.Tools.Office.Office2007_Properties.targets” />

Specify Properties in project file

Inside the first <PropertyGroup> tag you can add the following properties:

<ProductName>My VSTO Solution</ProductName>

<PublisherName>Visual Studio (BizApps)</PublisherName>

<OfficeApplicationDescription>A Sample Add-in created to show the add-in properties work</OfficeApplicationDescription>

<SupportUrl>http://www.microsoft.com</SupportUrl>

Once you have added these properties to the project file you can save the project and open it in Visual Studio. When you open this project you will get a warning stating that the project has been modified to use custom build steps. Choose the option to Load the project normally and proceed. From now onwards, these properties will be automatically be inserted into the manifest during publish. Any updates you make to these properties will also automatically be picked up by the publish system.

Modifying the targets file is a rather long and elaborate procedure, but once you complete it successfully you have the benefit of being able to specify these properties easily for any project.

Join the conversation

This is helpful but I seem to be missing something. I can use this tip to set the Publisher in Programs and Features, but how do I set the Publisher so that it appears in the Excel add-ins dialog? Even in the second screenshot above the Publisher shows <None> in the add-ins dialog.

Unfortunately specifying a Publisher Name that appears in the Office Add-ins dialog is currently not possible. Office does not examine the VSTO manifests for signature information and so that field does not work for VSTO add-ins.

I have image and icon file in my outlook 2007 vsto addins project. I have manage to publish the application on my local Internet. Also It installed on other client system. But the image and Icon file is missing from my application .

Also i have created the windows Installer setup and build project it work fine for me.

Looks like you are having trouble connecting to the FTP server from VS.

Make sure the FTP server is up and running and you have the right access permissions to put files on it. You could also try publishing it locally first and then uploading it to the server using a FTP client.

Displaying the publisher name in the Office add-ins dialog is certainly a common request and on our radar for feature requests. But as now the Publisher in the Office add-ins dialog will continue to show <none> for all VSTO solutions.

That does the job nicely. I actually wanted to do an Installer package rather than publish so I applied the change to the GenerateDeploymentManifest section under the VisualStudioApplicationsBuild target instead but that seesm to work. Thanks.

I use the ‘mage’ solution you described with success in deploying a Word add-in. But is there a way to change the .config file of my word add-in? If I first build my solution, than replace the config file (in the binrelease dir) and than:

– Specify the Product, Publisher and SupportURL properties

– Specify Friendly Name and Office Application Description:

– Sign deployment manifest

– Resign application manifest

– Update deployment manifest

– Resign deployment manifest

(as you described)

And then try to install the add-in, I’m getting the error:

File, XXXWordAddIn.dll.config, has a different computed hash than specified in manifest.

I didn't even think to look there, I was looking for it in the properties of the project itself, forgetting that it was being "published" (I haven't used click-one all that much in the past & not at all in 2010).

I have a OneClick Deployed VSTO Addin that I have signed with a up-to-date Verisign code-signing certificate (PFX). I have verified that I am signing correctly with Verisign support on the phone – they concur. I am building with VS2010. Nonetheless, the Addin shows “unknown publisher” when I try to install.

Why?

How can I replace “Unknown Publisher” with the name of the Publisher on the PFX certificate?

2.I used mage.exe to apply the PFX signature to both the application and deployment manifests to no avail; “Unknown Publisher” still shows when I install the Addin. Only then did I see you comment on the page of the last link that VSTO Addin's built under 2008 or earlier do not read either the application or deployment manifests.

I am facing the issue that my vsto addin is not displaying publisher name in outlook add-in dialog. It showing as <None>. I am using VS2013 for development. I tried by signing it but did not work. Can anybody please give some specific steps to do it.

Error 1 The "RegisterOfficeAddin" task could not be loaded from the assembly Microsoft.VisualStudio.OfficeTools.Build.Tasks, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or assembly 'Microsoft.VisualStudio.OfficeTools.Build.Tasks, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. IDesignSpecWord2007

Error 1 The "RegisterOfficeAddin" task could not be loaded from the assembly Microsoft.VisualStudio.OfficeTools.Build.Tasks, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or assembly 'Microsoft.VisualStudio.OfficeTools.Build.Tasks, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. IDesignSpecWord2007

Error 3 The "SetInclusionListEntry" task could not be loaded from the assembly Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or assembly 'Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. IDesignSpecWord2007