VSTO 3.0 Programming and Deploying an Excel Add-In <ul><li>Miguel Santos </li></ul><ul><li>Sr. Software Developer </li></u...
Agenda <ul><li>Define VSTO and Add-In </li></ul><ul><li>Create, Build and Deploy Excel Add-In on Visual Studio Tools for M...
Assumptions <ul><li>Excel 2007 </li></ul><ul><li>VS 2008 setup project </li></ul><ul><li>Excel automation </li></ul>
VSTO Definition <ul><li>Microsoft’s strategic tool for developing Office solutions. </li></ul><ul><li>It helps building ap...
VSTO Definition (cont) <ul><li>VSTO makes Office development available to .NET developers </li></ul><ul><ul><li>Provides a...
VSTO History <ul><li>Before VSTO (VBA and COM automation using C++ and VB6) </li></ul><ul><li>VSTO 2003. Target: Office 20...
VSTO History (cont) <ul><li>VSTO 3.0. Target: Office 2003/2007. Integrated to VS2008. </li></ul><ul><li>VSTO 2010 (v4 – Ap...
VSTO 3  Programming  New features <ul><li>Visual designer for Ribbons </li></ul><ul><li>Excel, Word 2007 document support....
VSTO 3 Deployment New features  <ul><li>NET Framework 3.5/SP1 client profile </li></ul><ul><li>Click Once </li></ul><ul><l...
VSTO Add-In <ul><li>Application-level solution resides in the program itself. </li></ul><ul><li>Class-library project asso...
VSTO Add-In (cont) <ul><li>It supports Office 2003: Excel, Word, Outlook, Powerpoint, Project, Visio </li></ul><ul><li>It ...
Excel Add-In <ul><li>Application add-in resides in Excel in an AppDomain. </li></ul><ul><li>VSTO creates the class library...
Excel Add-In <ul><li>Demo Hello World </li></ul>
Excel Object Model <ul><li>Excel PIA are managed assemblies that wrap the Office COM-based interfaces for use within .NET ...
Application <ul><li>It represents the Excel application itself. </li></ul><ul><li>Properties: ActiveWorkbook, ActiveSheet,...
Workbook <ul><li>It represents an Excel workbook. </li></ul><ul><li>Properties: ActiveSheet, Name, Sheets, Worksheets, Vis...
Worksheet <ul><li>It represents an Excel worksheet. </li></ul><ul><li>Properties: Cells, ActiveCell, Name, Visible </li></...
Range <ul><li>It represents an Excel range. </li></ul><ul><li>Properties: Borders, Cells, Name, Value2 </li></ul><ul><li>M...
Ribbon <ul><li>New way to implement menu items in Office (Replaces menu and toolbar) </li></ul><ul><li>It contains tabs th...
Excel Add-In <ul><li>Demo Common Tasks </li></ul>
Deployment Overview <ul><li>Options: </li></ul><ul><ul><li>ClickOnce </li></ul></ul><ul><ul><li>MSI/Setup.exe </li></ul></...
Deployment Steps <ul><li>Check/Install prerequisites </li></ul><ul><li>Deploy Add-In (HKCU) </li></ul><ul><li>Update regis...
Deployment Windows Installer <ul><li>Custom branding installation </li></ul><ul><li>Can deploy additional assemblies/compo...
Windows Installer Prerequisites <ul><li>Windows Installer 3.1 </li></ul><ul><li>NET Framework 3.5/SP1 </li></ul><ul><li>VS...
Create Windows Installer <ul><li>Prepare development PC. (VS 2008 SP1, .NET 3.5SP1) </li></ul><ul><li>Create Add-In and ba...
Create Windows Installer (cont) <ul><li>Configure launch conditions </li></ul><ul><ul><li>VSTO run time </li></ul></ul><ul...
Create Windows Installer (Optional) <ul><li>Bootstrap component check setup. (Office 2003 PIA) </li></ul><ul><li>Language ...
Deployment Windows Installer <ul><li>Demo Excel Add-In msi. </li></ul>
Troubleshooting <ul><li>VSTO Troubleshooter </li></ul><ul><li>Windows Event log contains Deployment and installation error...
Summary <ul><li>VSTO is a set of Visual Studio project templates and runtimes for building add-ins for Microsoft Office so...
Resources <ul><li>MSDN </li></ul><ul><ul><li>Excel Object Model Overview </li></ul></ul><ul><ul><li>Deploying Office Solut...
Resources (Cont) <ul><li>Blogs </li></ul><ul><ul><li>VSTO Team   </li></ul></ul><ul><ul><li>Andrew Coates </li></ul></ul><...
VSTO 2010 improvements <ul><li>C# support for optional parameters. </li></ul><ul><li>Click once: </li></ul><ul><ul><li>Set...
Thank you  <ul><li>Q & A </li></ul>
Upcoming SlideShare
Loading in...5
×

Vsto 3 Snug

1,184

Published on

This ia a presentation that I did at my local user group. It provides the basics to get you started in how to program and deploy an Excel Add-In using C#

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,184
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Alternative to build the setup program yourself: Add-in Express 2009 for Microsoft Office and VSTO (commercial product) www.add-in-express.com
  • Transcript of "Vsto 3 Snug"

    1. 1. VSTO 3.0 Programming and Deploying an Excel Add-In <ul><li>Miguel Santos </li></ul><ul><li>Sr. Software Developer </li></ul><ul><li>Nielsen </li></ul><ul><li>Email: [email_address] </li></ul>
    2. 2. Agenda <ul><li>Define VSTO and Add-In </li></ul><ul><li>Create, Build and Deploy Excel Add-In on Visual Studio Tools for Microsoft Office System (VSTO) 3.0 / Visual Studio .NET 2008 SP1 </li></ul><ul><li>Deployment & Security </li></ul><ul><li>Troubleshooting Deployment </li></ul><ul><li>Demos </li></ul>
    3. 3. Assumptions <ul><li>Excel 2007 </li></ul><ul><li>VS 2008 setup project </li></ul><ul><li>Excel automation </li></ul>
    4. 4. VSTO Definition <ul><li>Microsoft’s strategic tool for developing Office solutions. </li></ul><ul><li>It helps building applications that run on MS Office. </li></ul><ul><li>VSTO solutions are secure and easy to deploy </li></ul><ul><ul><li>Based on .NET Code Access Security </li></ul></ul><ul><ul><li>Offers ClickOnce deployment model as one of the development options </li></ul></ul>
    5. 5. VSTO Definition (cont) <ul><li>VSTO makes Office development available to .NET developers </li></ul><ul><ul><li>Provides all the productivity of Visual Studio IDE </li></ul></ul><ul><ul><li>Provides all the power of the .NET Framework. </li></ul></ul><ul><ul><li>Leverages the skills of .NET developers </li></ul></ul>
    6. 6. VSTO History <ul><li>Before VSTO (VBA and COM automation using C++ and VB6) </li></ul><ul><li>VSTO 2003. Target: Office 2003 </li></ul><ul><li>VSTO 2005. Target: Office 2003(Outlook) </li></ul><ul><li>VSTO 2005 Second Edition. Target: Office 2003/2007 </li></ul>
    7. 7. VSTO History (cont) <ul><li>VSTO 3.0. Target: Office 2003/2007. Integrated to VS2008. </li></ul><ul><li>VSTO 2010 (v4 – April 2010). Target: Office 2003/2007/2010 </li></ul>
    8. 8. VSTO 3 Programming New features <ul><li>Visual designer for Ribbons </li></ul><ul><li>Excel, Word 2007 document support. </li></ul><ul><li>Task panes </li></ul><ul><li>Smart tags </li></ul><ul><li>Rich user interface controls </li></ul>
    9. 9. VSTO 3 Deployment New features <ul><li>NET Framework 3.5/SP1 client profile </li></ul><ul><li>Click Once </li></ul><ul><li>Office 2007 System as prerequisites </li></ul><ul><li>VSTO Power Tools </li></ul>
    10. 10. VSTO Add-In <ul><li>Application-level solution resides in the program itself. </li></ul><ul><li>Class-library project associated with a supported Office application </li></ul><ul><li>Library assembly runs as an add-in within the host application's domain </li></ul>
    11. 11. VSTO Add-In (cont) <ul><li>It supports Office 2003: Excel, Word, Outlook, Powerpoint, Project, Visio </li></ul><ul><li>It supports Office 2007: Excel, Word, Outlook, InfoPath, Powerpoint, Project, Visio </li></ul>
    12. 12. Excel Add-In <ul><li>Application add-in resides in Excel in an AppDomain. </li></ul><ul><li>VSTO creates the class library project. </li></ul><ul><li>It defines main object: ThisAddIn. </li></ul><ul><li>It creates two methods: Startup, Shutdown. </li></ul><ul><li>It adds required Excel/VSTO references. </li></ul>
    13. 13. Excel Add-In <ul><li>Demo Hello World </li></ul>
    14. 14. Excel Object Model <ul><li>Excel PIA are managed assemblies that wrap the Office COM-based interfaces for use within .NET development </li></ul><ul><li>Key objects are: </li></ul><ul><ul><ul><li>Application </li></ul></ul></ul><ul><ul><ul><li>Workbook </li></ul></ul></ul><ul><ul><ul><li>Worksheet </li></ul></ul></ul><ul><ul><ul><li>Range </li></ul></ul></ul>
    15. 15. Application <ul><li>It represents the Excel application itself. </li></ul><ul><li>Properties: ActiveWorkbook, ActiveSheet, ActiveCell, Workbooks </li></ul><ul><li>Methods: Quit, Run, Save </li></ul><ul><li>Code: Globals.ThisAddIn.Application </li></ul>
    16. 16. Workbook <ul><li>It represents an Excel workbook. </li></ul><ul><li>Properties: ActiveSheet, Name, Sheets, Worksheets, Visible </li></ul><ul><li>Methods: SaveAs </li></ul><ul><li>Events: WindowActivate, BeforeClose </li></ul><ul><li>Code: Application.ActiveWorkBook </li></ul>
    17. 17. Worksheet <ul><li>It represents an Excel worksheet. </li></ul><ul><li>Properties: Cells, ActiveCell, Name, Visible </li></ul><ul><li>Methods: Copy, Select, SaveAs </li></ul><ul><li>Events: SelectionChange </li></ul><ul><li>Code: (Excel.Worksheet) Application.ActiveSheet </li></ul>
    18. 18. Range <ul><li>It represents an Excel range. </li></ul><ul><li>Properties: Borders, Cells, Name, Value2 </li></ul><ul><li>Methods: Activate, Clear, Copy, Select </li></ul><ul><li>Code: Application.ActiveCell, Application.Cells </li></ul>
    19. 19. Ribbon <ul><li>New way to implement menu items in Office (Replaces menu and toolbar) </li></ul><ul><li>It contains tabs that hold all required commands/window controls. </li></ul><ul><li>Add ribbon to add-in project. </li></ul><ul><li>Options: Visual designer or Xml </li></ul><ul><li>Available windows controls are button, combo box, checkbox, etc. </li></ul>
    20. 20. Excel Add-In <ul><li>Demo Common Tasks </li></ul>
    21. 21. Deployment Overview <ul><li>Options: </li></ul><ul><ul><li>ClickOnce </li></ul></ul><ul><ul><li>MSI/Setup.exe </li></ul></ul><ul><ul><li>Document Deployment with WSS/MOSS </li></ul></ul>
    22. 22. Deployment Steps <ul><li>Check/Install prerequisites </li></ul><ul><li>Deploy Add-In (HKCU) </li></ul><ul><li>Update registry and </li></ul><ul><li>Set up security (Full trust) </li></ul>
    23. 23. Deployment Windows Installer <ul><li>Custom branding installation </li></ul><ul><li>Can deploy additional assemblies/components and registry settings. </li></ul><ul><li>Can allow custom configuration via user interaction </li></ul><ul><li>More developer effort </li></ul><ul><li>No automatic updates </li></ul>
    24. 24. Windows Installer Prerequisites <ul><li>Windows Installer 3.1 </li></ul><ul><li>NET Framework 3.5/SP1 </li></ul><ul><li>VSTO Runtime SP1 </li></ul><ul><li>Office 2007 PIA </li></ul>
    25. 25. Create Windows Installer <ul><li>Prepare development PC. (VS 2008 SP1, .NET 3.5SP1) </li></ul><ul><li>Create Add-In and basic installer project. </li></ul><ul><li>Add Add-in project as project output group. </li></ul><ul><li>Add deployment and application manifests. </li></ul><ul><li>Configure prerequisites </li></ul><ul><li>Add registry settings </li></ul>
    26. 26. Create Windows Installer (cont) <ul><li>Configure launch conditions </li></ul><ul><ul><li>VSTO run time </li></ul></ul><ul><ul><li>Office Shared PIA </li></ul></ul><ul><ul><li>Excel PIA </li></ul></ul><ul><li>Configure a single-user installation </li></ul><ul><li>Build MSI/Setup.exe. </li></ul>
    27. 27. Create Windows Installer (Optional) <ul><li>Bootstrap component check setup. (Office 2003 PIA) </li></ul><ul><li>Language pack. </li></ul><ul><li>More assembly/components </li></ul><ul><li>Click once cache deployment </li></ul><ul><li>All users deployment – See Misha’s blog </li></ul><ul><li>Vista deployment- check UAC compliant box </li></ul>
    28. 28. Deployment Windows Installer <ul><li>Demo Excel Add-In msi. </li></ul>
    29. 29. Troubleshooting <ul><li>VSTO Troubleshooter </li></ul><ul><li>Windows Event log contains Deployment and installation error messages </li></ul>
    30. 30. Summary <ul><li>VSTO is a set of Visual Studio project templates and runtimes for building add-ins for Microsoft Office solutions. </li></ul><ul><li>Introduction to Excel's main objects and how to perform common tasks using VSTO </li></ul><ul><li>Deployment using Windows Installer has been simplified but it is still a complex task. </li></ul>
    31. 31. Resources <ul><li>MSDN </li></ul><ul><ul><li>Excel Object Model Overview </li></ul></ul><ul><ul><li>Deploying Office Solutions </li></ul></ul><ul><ul><li>Security in Office Solutions </li></ul></ul><ul><ul><li>Deploying a VSTO 3.0 Solution Using Windows Installer </li></ul></ul><ul><ul><ul><li>(Part 1 of 2) </li></ul></ul></ul><ul><ul><ul><li>(Part 2 of 2) </li></ul></ul></ul>
    32. 32. Resources (Cont) <ul><li>Blogs </li></ul><ul><ul><li>VSTO Team </li></ul></ul><ul><ul><li>Andrew Coates </li></ul></ul><ul><ul><li>Andrew Whitechappel </li></ul></ul><ul><ul><li>Misha Shneerson </li></ul></ul><ul><ul><ul><li>Deploying your VSTO 2008 Add-In to All Users Part I , Part II , Part III </li></ul></ul></ul>
    33. 33. VSTO 2010 improvements <ul><li>C# support for optional parameters. </li></ul><ul><li>Click once: </li></ul><ul><ul><li>Setup can target multiple Office application. </li></ul></ul><ul><ul><li>Post deployment custom actions. (e.g. moving files to user directories, deleting files during uninstall , registry ) </li></ul></ul><ul><ul><li>No-PIA installs. ( PIA is part of the .NET framework) </li></ul></ul>
    34. 34. Thank you <ul><li>Q & A </li></ul>
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×