Develop Office Client Applications using Visual Studio
You may want to develop Microsoft Office 2003 solutions with Visual Studio Tools for Office (VSTO) in Visual Studio 2008 SP1 for several reasons.
Once you're done with development, you'll want to deploy your Microsoft Office 2003 solutions to your end users. This process involves the following steps:
Due to customer demand, I've created five deployment samples that demonstrate these steps. Step 1 is demonstrated in two ways: you can select your prerequisites through the Prerequisites Dialog Box to be installed with the Setup.exe bootstrapper; alternatively, you can configure launch conditions in the Setup project to only install the customization if the prerequisites already exist.
Prerequisites Dialog Box:
Launch Conditions editor:
You can use the Setup project to complete step 2 by copying the customization assembly and for document-level projects, the document or workbook, to the designated installation location. This is done by adding the project output with the File System Editor. The default installation location in these Setup projects is %PROGRAMFILES%\MyCompany\<Name of Setup Project>.
File System Editor:
Full trust is granted by using the SetSecurity project for step 3. This code uses a custom action in the Setup project to create a code access security policy that creates a solution code group for your Office solution, and an assembly code group for the customization assembly.
Custom Actions Editor:
Step 4 only applies to application-level add-ins: when you use the Excel 2003 add-in or Word 2003 add-in project templates, there is a Setup project automatically added to your Office solution that already creates the registry keys documented in Registry Entries for Application-Level Add-Ins.
The process of preparing the development computer for deployment and configuring the Setup project is written out step-by-step in the following two whitepapers:
Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer (Part 1 of 2)
Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer: Walkthroughs (Part 2 of 2)
Now, it's time to experiment on your own. Download the sample code and the completed installers from the MSDN Code Gallery: http://code.msdn.microsoft.com/VSTO2005SEMSI
Mary Lee, Programming Writer.
How to add VSTO assembly into reference in Visual Studio Express version?
the VSTO project templates are only available in Visual Studio Professional Edition and higher. for more information about the Visual Studio editions that support VSTO, see http://msdn.microsoft.com/en-us/library/bb398242.aspx
I'm having a rough time deploying a working MSI with the instructions at this URL.
I worked through some issues. Now, when I run the MSI, I have the following message...
"cannot set the security policy specified solution code group name is not valid" (not exact)
I am trying to deploy an Excel 2003 VSTO application and running Visual Studio 2008. I'm in a time crunch, so any timely advice that will solve my problems is very much appreciated.
did you check the spelling of your solution code group name in the custom action for the SetSecurity project?
also, you can look at the deployment samples at http://code.msdn.microsoft.com/VSTO2005SEMSI and compare your setup project for differences.
Check the spelling in what way? Am I supposed to edit that value to match something else? The directions are pretty long and complicated, so I may have missed something. Thanks.
Also, it seems that I cannot get various prerequisites to show up, such as Excel 2003 Interop. I thought I had taken the steps to make them show up in the list, but I still do not see them. Thanks again.
I just attempted to download one of the setups and opened in Visual Studio. I received a message about the location not being trusted. What do I need to do to fix this? Thanks again.
I also just built the Excel2003WorkbookSetup, went to the release folder and tried to run the setup.exe as well as the msi, I received a message that "Visual Studio Tools 2005 Tools for Office SE Runtime is not installed. Please run setup.exe"
So, there's more issues for me. Nothing seems to work exactly right for me. Is there an easier way or better instructions? Thanks again!
can you please post your question in the VSTO forum at http://social.msdn.microsoft.com/forums/en-US/vsto/threads/? i'll answer it over there instead of using the comment section here.
here's a short answer:
deploying VSTO Office solutions is going to just as difficult as developing Office solutions. you're seeing the "VSTO 2005 SE runtime is not installed" error because the development computer wasn't configured to package all the prerequisites: VSTO 2005 SE runtime, .NET Framework 2.0, and the Office 2003 primary interop assemblies.
all these steps are outlined in the whitepapers linked at the bottom of the blog entry. your comment linked to part 2 of 2, but you also need to complete part 1 of 2 before part 2 will work.
Yes, I see the steps to add VSTO 2005 SE runtime and Office 2003 primary interop assemblies from the prerequisites. Unfortunately, they do not appear in my prerequisite list. I've been searching the web up and down for a way to make them appear in my prerequisites list. I installed some sort of bootstrapper, hoping that would do the trick. I still don't understand how to do it. If someone could please help me, I would very much appreciate it. Nothing seems to work very smoothly with this process it seems.
I've try to deploy my add in for everyone on the customer cumputer but it does not work.
If not a direct answer in reply to this comment, would you point me somewhere in MSDN?
I am developing a VSTO solution for Excel. The end users have Excel 2003 or Excel 2007. Some may have both side-by-side.
I want to build an add-in level solution. Since most users are on Excel 2003, I intent to build an Excel 2003 add-in project on my developer PC. From what I've read, Excl 2003 projects will execute if the end-user has Excel 2007 and gets my Excel 2003 add-in deployed.
However, some questions arose, as both development and end-user machines present problems for me, I think.
Here are some needs:
1. I am using C#, and want to use .NET 3.5 as there are several assemblies with key features that enhance the project.
2. End-users may not have .NET 3.5, so it would need to be a pre-requisite or included in the deployment solution. I’m new to this issue as previously the company I worked at for 7 years would handle the .NET install for me and upgrade clients.
3. POSSIBLY A BIG ISSUE: End-users may have Excel 2003, 2007, or both. Does this present a challenge?
4. POSSIBLY A BIGGER ISSUE: My developer machine has Excel 2003 AND OFFICE 2007. I read somewhere (can't remember the URL) on MSDN or a VSTO Team Blog, that a developer:
(a) should not have both Office 2003 and 2007 installed on their computer when developing a VSTP solution. WHY is this a problem, if it is in fact true?
(b) you should develop for the lowest version (Excel 2003). If you want to exploit 2007-only features, such as the Ribbon, you should develop a separate add-in solution for Excel 2007 ONLY.
So does this mean I need TWO developer machines (or a dual-boot, etc)? I mean, do I need:
(a) an OFFICE 2007-only developer instance for developing Excel 2007 VSTO solutions
(b) an OFFICE 2003-only developer instance for developing Excel 2003 VSTO solutions
Mary, your deployment videos, content, and example code have been insightful and quite helpful. And if this is not appropriate as a comment on this page, I’d b very happy to have it moved to a forum.
Thanks for your feedback. It's great to hear customer feedback, good and bad, to improve our products and documentation. Blog comments are a good way to query for information, but the forums are better for troubleshooting problems in development and deployment.
1. If you use the Office 2003 project templates, the minimum version is .NET Framework 2.0. Even if you use .NET Framework 3.5, you won't be able to use the ClickOnce deployment feature because the Office 2003 project templates still use the VSTO 2005 SE runtime. For more information about the VSTO runtime versions, see http://msdn.microsoft.com/en-us/library/bb608603.aspx.
2. You can include .NET Framework 3.5 as a prerequisite in your Windows Installer setup project using the Prerequisites Dialog Box: http://msdn.microsoft.com/en-us/library/7tx0bw8y.aspx.
3. End users can have multiple versions of Office installed, although it's not recommended. It's the developer that cannot. Per http://blogs.msdn.com/andreww/archive/2007/06/15/can-you-build-one-add-in-for-multiple-versions-of-office.aspx, "Office does support running multiple versions of Office on the same machine, although it is discouraged. What's not supported is developing with VS on a machine with multiple versions of Office."
4. Office development should not be done on a computer with multiple versions of Office installed, per http://msdn.microsoft.com/en-us/library/bb398242.aspx:
"Visual Studio Tools for Office does not support installing Microsoft Office 2003 and the 2007 Microsoft Office system (or different versions of the same application, such as Word 2003 and Word 2007) side-by-side on the development computer. To develop solutions for different versions of Microsoft Office, use a different development computer for each version of Microsoft Office."
The explanation behind this restriction is best explained by Andrew Whitechapel: http://blogs.msdn.com/andreww/archive/2007/06/08/why-is-vs-development-not-supported-with-multiple-versions-of-office.aspx
However, you don't necessarily have to have two development computers because you can develop Excel 2003 solutions on a computer with Excel 2007. You can choose the Excel 2003 project templates, but by default, VS is configured to automatically upgrade the project to the latest version of Office that is on the development computer. Harry Miller created a video about how to change this behavior at http://blogs.msdn.com/vsto/archive/2008/07/24/automatic-project-conversion-migration-harry-miller.aspx
There are some guidelines about developing for multiple versions of Office at http://msdn.microsoft.com/en-us/library/bb772080.aspx. Andrew also goes into much more detail in his blog:
Thank you very much for a prompt reply and a thorough detailed fully-linked collection of information. I truly appreciate it!
BTW, what is your official title at Microsoft, if I may kindly ask?
Kevin Novick (aka KAVLAK)