<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Office Development with Visual Studio : primary interop assemblies</title><link>http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx</link><description>Tags: primary interop assemblies</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Can I deploy my &lt;Insert App Name Here&gt; and all of its prerequisites in one file? (Mary Lee)</title><link>http://blogs.msdn.com/vsto/archive/2009/10/14/can-i-deploy-my-insert-app-name-here-and-all-of-its-prerequisites-in-one-file-mary-lee.aspx</link><pubDate>Wed, 14 Oct 2009 22:16:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9907343</guid><dc:creator>VSTO Team</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9907343.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9907343</wfw:commentRss><description>&lt;p&gt;One frequent customer question is about how to deploy an application and all of its prerequisites in a single .msi or .exe file. This question applies whether you are deploying any of the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Microsoft Office 2003 solutions with dependencies on .NET Framework 2.0, Visual Studio Tools for Office 2005 SE runtime, Microsoft Office 2007 primary interop assemblies. &lt;/li&gt;    &lt;li&gt;Microsoft Office 2007 solutions with dependencies on .NET Framework 3.5 , Visual Studio Tools for Office runtime 3.0, Microsoft Office 2007 primary interop assemblies. &lt;/li&gt;    &lt;li&gt;Microsoft Office 2007 solutions with dependencies on .NET Framework 3.5 SP1, Visual Studio Tools for Office runtime 3.0 SP1, Microsoft Office 2007 primary interop assemblies. &lt;/li&gt;    &lt;li&gt;Microsoft Office 2007 solutions with dependencies on .NET Framework 3.5 SP1 Client Profile, Visual Studio Tools for Office runtime 3.0 SP1, Microsoft Office 2007 primary interop assemblies. &lt;/li&gt;    &lt;li&gt;Really, any WinForms/WPF/console/whatever app with dependencies on .NET Framework, SQL Server Express, SQL Server compact, Visual C++ runtime, Windows Installer, or anything else. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;There are three concepts in deployment related to prerequisites: nesting, merging, and chaining or bootstrapping.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Nesting&lt;/strong&gt; is the process of embedding a Windows Installer file (.msi) within another .msi file. However, the &lt;a href="http://support.microsoft.com/kb/306439"&gt;How to create a nested .msi package&lt;/a&gt; article has an important disclaimer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/CanIdeploymyInsertAppNameHereandallofits_8404/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/CanIdeploymyInsertAppNameHereandallofits_8404/image_thumb.png" width="555" height="80" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The drawbacks of creating a nested MSI installation are listed in the same article.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Nested Installations cannot share components. &lt;/li&gt;    &lt;li&gt;An administrative installation cannot contain a nested installation. &lt;/li&gt;    &lt;li&gt;Patching and upgrading will not work with nested installations. &lt;/li&gt;    &lt;li&gt;The installer will not correctly cost a nested installation. &lt;/li&gt;    &lt;li&gt;Integrated ProgressBars cannot be used with nested installations. &lt;/li&gt;    &lt;li&gt;Resources that are to be advertised cannot be installed by the nested installation. &lt;/li&gt;    &lt;li&gt;A package that performs a nested installation of an application should also uninstall the nested application when the parent product is uninstalled. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For these reasons, nesting is no longer supported. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Merging&lt;/strong&gt; includes shared code, files, resources, registry entries, and setup logic to applications as a single compound file. Prerequisites available as a merge module (.msm) form can be added to a .msi file. For example, if a prerequisite is available as an .msm, you can add it to a Setup project in Visual Studio as shown in &lt;a href="http://msdn.microsoft.com/en-us/library/z6z02ts5(VS.100).aspx"&gt;How to: Create or Add a Merge Module Project&lt;/a&gt;. However, merge modules cannot be serviced by the same owner as the .msi file, so it is difficult to fix issues in the merge module. &lt;a href="http://blogs.msdn.com/windows_installer_team/archive/2006/06/27/648447.aspx"&gt;Tao of the Windows Installer, Part 4&lt;/a&gt; lists two cautionary notes:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Do not consume merge modules of vendors who do not promise to fix their merge modules promptly when bugs arrive &lt;/li&gt;    &lt;li&gt;Be prepared to handle the heat when bugs are found in your merge module causing issues for others’ products that have consumed your merge module and you get to put out the flame &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For these reasons, using merge modules is not recommended.&lt;/p&gt;  &lt;p&gt;Nesting and merging create a single file to deploy an application and its prerequisites, but these methods are not supported and not recommended. Thus, the answer to the question in the title is no: you cannot or should not deploy an application and its prerequisites in one file. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Chaining&lt;/strong&gt; or &lt;strong&gt;bootstrapping&lt;/strong&gt; is the process of checking for and installing missing prerequisites, including installing the application that is going to be used to install the rest of the prerequisites and application. You can use Visual Studio to generate a chainer/bootstrapper that is called Setup.exe. This program checks for and installs missing prerequisites before installing the application or Office solution. &lt;/p&gt;  &lt;p&gt;If you are deploying an Office 2007 solution in Visual Studio 2008 SP1, the .NET Framework 3.5 SP1, Visual Studio Tools for Office 3.0 SP1 runtime, and Microsoft Office 2007 primary interop assemblies are already selected in the Prerequisites Dialog Box.&lt;/p&gt;  &lt;p&gt;To learn more about how to install prerequisites in Visual Studio, see the following topics.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb608608(VS.100).aspx"&gt;How to: Install Prerequisites on End User Computers to Run Office Solutions&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/7eh4aaa5(VS.100).aspx"&gt;How to: Install Prerequisites in Windows Installer Deployment&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/8st7th1x(VS.100).aspx"&gt;How to: Install Prerequisites with a ClickOnce Application&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If the prerequisite package does not appear in Visual Studio, you can create your own bootstrapper package. After you create a product.xml file that describes the prerequisite and a package.xml files that includes locale-specific error messages, you can copy the bootstrapper package to \Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages folder. For more information, see &lt;a href="http://msdn.microsoft.com/en-us/library/ms165429(VS.100).aspx"&gt;Creating Bootstrapper Packages&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Other tools besides Visual Studio: You can also use MSBuild and the &lt;a href="http://msdn.microsoft.com/en-us/library/ms164294.aspx"&gt;GenerateBootstrapper Task&lt;/a&gt; to create a bootstrapper on a build computer. Alternatively, you can use the Windows Installer XML Toolset to generate .msi files and package prerequisites. For more information, see &lt;a title="http://wix.sourceforge.net/" href="http://wix.sourceforge.net/"&gt;http://wix.sourceforge.net/&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;For questions about bootstrapping, search for answers or post new questions in the &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/winformssetup/threads"&gt;ClickOnce and Setup &amp;amp; Deployment forum&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Happy deployment!&lt;/p&gt;  &lt;p&gt;Mary Lee, Programming Writer.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9907343" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Mary+Lee/default.aspx">Mary Lee</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Windows+Installer/default.aspx">Windows Installer</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx">primary interop assemblies</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Bootstrapper/default.aspx">Bootstrapper</category></item><item><title>Will your VSTO addin run on Office 2010 64-bit? Yes, probably. (Christin Boyd)</title><link>http://blogs.msdn.com/vsto/archive/2009/08/05/will-your-vsto-addin-run-on-office-2010-64-bit-yes-probably-christin-boyd.aspx</link><pubDate>Thu, 06 Aug 2009 01:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9858450</guid><dc:creator>VSTO Team</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9858450.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9858450</wfw:commentRss><description>&lt;p&gt;The Visual Studio team is designing the runtime components for Office 2010 so that your Visual Studio Tools for Office 2005 and Visual Studio 2008 .NET addins, document solutions and spreadsheet solutions will run on 64-bit Office 2010.&amp;#160; These runtime components will ship with Office 2010, so your end-users won’t even have to download a new runtime!&amp;#160; How easy is that?&amp;#160; There are a few rare exceptions that I’ll discuss in this blog entry.&amp;#160; &lt;/p&gt;  &lt;p&gt;The miracle of managed code allows you to write C# or Visual Basic .NET code that compiles to “Any CPU” using the Compile setting in your Visual Studio project.&amp;#160; Your code compiles to MSIL with Visual Studio, and then at runtime it gets JIT compiled to the correct chip set, either AMD, Intel, 32-bit or 64-bit.&amp;#160; The first exception to this wondrous technology is the oldest versions of .NET Framework 1.0 and 1.1 will not enable this 64-bit transformation.&lt;/p&gt;  &lt;p&gt;The other thing to lookout for is calls to process invoke (p/invoke) in your code. If you try to call native API methods using p/invoke you could have issues with your VSTO solution running properly on 64-bit Office 2010.&amp;#160; &lt;/p&gt;  &lt;p&gt;You will have problems if your code makes deliberate calls to p/invoke a Win32 API that does not have exactly the same signature (method name, parameter list, and DLL name) of an equivalent Win64 API.&amp;#160; This is true for any solution you write regardless of targeting Office as the platform.&amp;#160; You can find a ton of information in MSDN and blogs by such luminaries as Scott Hanselman about writing Windows API calls so that they will run on either 32-bit or 64-bit Windows.&amp;#160; Here is a generalized code snippet for handling cases where the method name or the DLL name is different:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; height: 244px; background-color: #f4f4f4; text-align: left"&gt;   &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;p align="left"&gt;&lt;span style="color: #008000"&gt;//YourFunction has the same name, parameters, and DLL name in 32bit and 64bit&lt;/span&gt;&lt;br /&gt;YourFunction();&lt;br /&gt;&lt;br /&gt;Import(&lt;span style="color: #006080"&gt;&amp;quot;LIBRARY&amp;quot;&lt;/span&gt;, EntryPoint = &lt;span style="color: #006080"&gt;&amp;quot;YOURFUNCTION&amp;quot;&lt;/span&gt;, CharSet = CharSet.Unicode)]&lt;br /&gt;private &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;extern&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; YouFunction();&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;//In some cases, the method name is different in Win32 API and Win64 API, &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;//so use the following code block in stead of the above 3 lines of code.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Marshal.SizeOf(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(IntPtr)) == 4)&lt;br /&gt;{&lt;br /&gt;    YourFunction32();&lt;br /&gt;}&lt;br /&gt;&lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Marshal.SizeOf(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(IntPtr)) == 8)&lt;br /&gt;{&lt;br /&gt;    YourFunction64();&lt;br /&gt;}&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Import(&lt;span style="color: #006080"&gt;&amp;quot;LIBRARY32&amp;quot;&lt;/span&gt;, EntryPoint = &lt;span style="color: #006080"&gt;&amp;quot;YOURFUNCTION32&amp;quot;&lt;/span&gt;, CharSet = CharSet.Unicode)]&lt;br /&gt;private &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;extern&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; YourFunction32();&lt;br /&gt;&lt;br /&gt;Import(&lt;span style="color: #006080"&gt;&amp;quot;LIBRARY64&amp;quot;&lt;/span&gt;, EntryPoint = &lt;span style="color: #006080"&gt;&amp;quot; YOURFUNCTION64&amp;quot;&lt;/span&gt;, CharSet = CharSet.Unicode)]&lt;br /&gt;private &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;extern&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; YourFunction64();&lt;br /&gt;&lt;/p&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;h3&gt;Resources:&lt;/h3&gt;

&lt;p&gt;Here are more resources to help you author your solutions today so that they will run without needing a recompile when your users install 64-bit Office 2010.&lt;/p&gt;

&lt;p&gt;MSDN Library Visual Studio 2005 article on developing &lt;a href="http://msdn.microsoft.com/en-us/library/ms241064(VS.80).aspx" target="_blank"&gt;64-bit Applications&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MSDN Library Visual Studio 2008 article on developing &lt;a href="http://msdn.microsoft.com/en-us/library/ms241064.aspx" target="_blank"&gt;64-bit Applications&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cumgranosalis/archive/2005/12/09/Win64RegistryPart1.aspx" target="_blank"&gt;How to access the “real” x64 registry from a Win32 .NET Application – Part I&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms953313.aspx" target="_blank"&gt;The Myth of .NET Purity, Reloaded&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For migrating your really old apps with lots of native calls to .NET, try checking if your native calls have an equivalent .NET call:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa302340.aspx" target="_blank"&gt;Microsoft Win32 to Microsoft .NET Framework API Map&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/sd10k43k.aspx" target="_blank"&gt;Interoperating with Unmanaged Code&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Finally I should mention that this is my last post (for a while at least) on this blog because I am leaving Microsoft.&amp;#160; I’m going to work on a charity project teaching robotics programming to high school kids in my “inner city” neighborhood for at least the next 6 months.&amp;#160; The project is called &lt;a href="http://www.teamxbot.org/" target="_blank"&gt;Team Xbot&lt;/a&gt;!&amp;#160; Keep an eye on these kids as they go on to good colleges and great jobs in the next few years!&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Sincerely, Christin Boyd, Program Manager&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9858450" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/runtime/default.aspx">runtime</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Christin+Boyd/default.aspx">Christin Boyd</category><category domain="http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx">primary interop assemblies</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+14/default.aspx">Office 14</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2010/default.aspx">Office 2010</category></item><item><title>BUG: “Old format or invalid type library” error when automating Excel (Christin Boyd)</title><link>http://blogs.msdn.com/vsto/archive/2009/07/06/bug-old-format-or-invalid-type-library-error-when-automating-excel-christin-boyd.aspx</link><pubDate>Tue, 07 Jul 2009 01:54:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9820860</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9820860.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9820860</wfw:commentRss><description>&lt;p&gt;A customer recently reported this bug when running their Shared Addin for Excel on French Windows.&amp;#160; &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Error: 0x80028018 (-2147647512)      &lt;br /&gt;Description: Old Format or Invalid Type Library&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;His solution worked great on English Windows, but gave errors in any other language.&amp;#160; This is a known problem in Excel and there are a few workarounds that work depending on the way you’re writing your Excel Addin.&amp;#160;&amp;#160; Let me take you through the problem, variations on the problem, and different solutions depending on which Visual Studio project template you choose to start your Addin.&lt;/p&gt;  &lt;p&gt;The bug was originally documented in a &lt;a href="http://support.microsoft.com/kb/320369" target="_blank"&gt;KB 320369 article&lt;/a&gt;, which gives detailed repro steps, explanation, and two workarounds with sample code.&amp;#160; So why am I writing a blog post if the KB article covers everything?&amp;#160;&amp;#160; Three reasons.&amp;#160; &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Because we’re fixing the problem in CLR 4 and I want to encourage you to use one of the recommended workarounds in your current solutions so that you’re ready when your users upgrade to .NET Framework 4.&amp;#160; &lt;/li&gt;    &lt;li&gt;Also, there are parts of the KB article that are a bit confusing, so I’ll try to add some color commentary to help explain what’s causing the problem.&amp;#160; &lt;/li&gt;    &lt;li&gt;And third, these problems do not occur if you use VSTO 2005 SE, VSTO 3.0 (which ships with Visual Studio 2008), or Visual Studio 2010.&amp;#160; I’ll explain why and how later. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The KB article describes the problem:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Error: 0x80028018 (-2147647512)      &lt;br /&gt;Description: Old Format or Invalid Type Library&lt;/p&gt;    &lt;p&gt;You receive this error calling an Excel method when the following conditions are true: &lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;The method requires an LCID (locale identifier). &lt;/li&gt;      &lt;li&gt;You run an English version of Excel. However, the regional settings for the computer are configured for a non-English language. &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;If the client computer runs the English version of Excel and the locale for the current user is configured for a language other than English, Excel will try to locate the language pack for the configured language. If the language pack is not found, the error is reported.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The quote from the KB article is accurate, but can be confusing.&amp;#160; It is very difficult to determine if the Excel method you want to call requires LCID or not.&amp;#160; The Primary Interop Assembly (PIA) does not indicate whether or not the LCID is needed, however VBA does not hide the need for LCID.&amp;#160; Part of the reason why Excel hasn’t changed its methods is to maintain back compatibility with all the VBA code in the universe.&amp;#160; &lt;/p&gt;  &lt;h3&gt;Fixed in VSTO&lt;/h3&gt;  &lt;p&gt;VSTO implemented a fix in VSTO 2005 Second Edition (SE).&amp;#160; You can read more about this fix in &lt;a href="http://blogs.msdn.com/eric_carter/archive/2005/06/15/429515.aspx" target="_blank"&gt;Eric Carter’s blog post&lt;/a&gt;.&amp;#160; The fix is also in all subsequent versions of Visual Studio 2008 and will be in Visual Studio 2010.&amp;#160; You know you are using “VSTO” when you create a new Project in Visual Studio and select an Excel &amp;lt;version number&amp;gt; Workbook, Excel &amp;lt;version number&amp;gt; Template or Excel &amp;lt;version number&amp;gt; Addin.&amp;#160; The fix was not implemented in the Shared Addin template in any version of Visual Studio.&amp;#160; If you create a WinForms, WPF, Web or console application that calls Excel, then you will see this bug on non-English Windows.&lt;/p&gt;  &lt;h3&gt;Workarounds &lt;/h3&gt;  &lt;p&gt;If you are using the Shared Addin template, a WinForm, WPF, Web or Console application with any version of Visual Studio, then you should use the &lt;a href="http://support.microsoft.com/kb/320369" target="_blank"&gt;KB 320369 article&lt;/a&gt; to solve the problem.&lt;/p&gt;  &lt;p&gt;The workaround is to write explicit calls to set the thread’s culture before calling into Excel.&amp;#160; You can then reset the culture back to what it was before after you are finished calling Excel.&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Install the Multilingual User Interface Pack for your version of Office. &lt;/li&gt;    &lt;li&gt;Execute the Excel method or property by using &lt;b&gt;InvokeMember&lt;/b&gt; so that you can specify the &lt;b&gt;CultureInfo&lt;/b&gt; for the call. For example, the following code illustrates how you can invoke the &lt;b&gt;Workbooks&lt;/b&gt; object &lt;b&gt;Add&lt;/b&gt; method with &amp;quot;en-US&amp;quot; as the &lt;b&gt;CultureInfo&lt;/b&gt;:       &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;       &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oApp &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; Excel.Application()&lt;br /&gt;oApp.Visible = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;oApp.UserControl = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oBooks &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt; = oApp.Workbooks&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; ci &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Globalization.CultureInfo = &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; System.Globalization.CultureInfo(&lt;span style="color: #006080"&gt;&amp;quot;en-US&amp;quot;&lt;/span&gt;)&lt;br /&gt;oBooks.&lt;span style="color: #0000ff"&gt;GetType&lt;/span&gt;().InvokeMember(&lt;span style="color: #006080"&gt;&amp;quot;Add&amp;quot;&lt;/span&gt;, Reflection.BindingFlags.InvokeMethod, &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt;, oBooks, &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt;, ci)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Or, instead of the above bullet and code sample, set the &lt;b&gt;CultureInfo&lt;/b&gt; prior to calling the Excel method, and then you can reset it after your Excel call: &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;
    &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oApp &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; Excel.Application()&lt;br /&gt;oApp.Visible = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;oApp.UserControl = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oldCI &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Globalization.CultureInfo = _&lt;br /&gt;    System.Threading.Thread.CurrentThread.CurrentCulture&lt;br /&gt;System.Threading.Thread.CurrentThread.CurrentCulture = _&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; System.Globalization.CultureInfo(&lt;span style="color: #006080"&gt;&amp;quot;en-US&amp;quot;&lt;/span&gt;)&lt;br /&gt;oApp.Workbooks.Add()&lt;br /&gt;System.Threading.Thread.CurrentThread.CurrentCulture = oldCI&lt;/pre&gt;

    &lt;br /&gt;&lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;The .NET Framework 4 will solve this whole culture problem.&amp;#160; Excel is not going to change its culture sensitivity because of the need to support backwards compatibility.&amp;#160;&amp;#160; Starting with CLR 4.0, when managed code calls into a COM component and an LCID is required, then the CLR will pass LCID = 1033.&amp;#160; Note that this is how VBA passes LCIDs.&amp;#160;&amp;#160; This means that Visual Studio 2010 project templates for Excel Addins can stop wrapping all Excel projects with LCID proxy.&amp;#160;&amp;#160; In the future, when you use VS 2010 and .NET 4 to write your Excel automation programs from a Shared Addin, console, Winforms, WPF, or Web application, you won’t need to wrap your calls either.&amp;#160; &lt;/p&gt;

&lt;p&gt;-Christin Boyd, Program Manager &amp;amp; &lt;a href="http://blogs.msdn.com/mshneer/" target="_blank"&gt;Misha Shneerson&lt;/a&gt;, Senior Developer&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9820860" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Christin+Boyd/default.aspx">Christin Boyd</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2003/default.aspx">Excel 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx">primary interop assemblies</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VBA/default.aspx">VBA</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category></item><item><title>Best Practices for Deployment with Visual Studio 2008 SP1 (Mary Lee, Rachel Schaw)</title><link>http://blogs.msdn.com/vsto/archive/2009/02/02/best-practices-for-deployment-with-visual-studio-2008-sp1.aspx</link><pubDate>Tue, 03 Feb 2009 02:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9385465</guid><dc:creator>VSTO Team</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9385465.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9385465</wfw:commentRss><description>&lt;P&gt;After you develop Office solutions with Visual Studio Tools for Office, you can use Visual Studio 2008 SP1 to simplify your deployment experience. First, you can take advantage of the smaller .NET Framework Client Profile to decrease download time. Next, the Office 2007 primary interop assemblies (PIAs) are included in-the-box with VS2008 SP1 to avoid having to generate bootstrapper manifests. Finally, you can also troubleshoot any installation problems with the event viewer.&lt;/P&gt;
&lt;P&gt;Develop your Office 2007 solutions against the .NET Framework Client Profile.&amp;nbsp; The large size of the .NET Framework 3.5 SP1 can lead to long download times.&amp;nbsp; The .NET Framework Client Profile is only 25MB in size, so download times are reduced when installing from the component vendor's web site. For more information about how to configure your solution to use the .NET Framework Client Profile, see &lt;A href="http://msdn.microsoft.com/en-us/library/bb398202.aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb398202.aspx"&gt;How to: Target a Specific .NET Framework&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_8.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_8.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=416 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_thumb_3.png" width=544 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Deploying the Office 2007 primary interop assemblies is now (mostly) hassle-free. Visual Studio 2008 SP1 includes the Office 2007 PIAs as part of the update.&amp;nbsp; This relieves you from having to download the PIA installer, download a code sample that contains the bootstrapper manifests, move the manifests to a certain directory, compile the ComponentCheck.cpp file to verify that the correct version of Microsoft Office is installed, and dance the hula.&amp;nbsp; Instead, developing with one of the Visual Studio Tools for Office project templates already marks the Microsoft Office 2007 primary interop assemblies as a prerequisites.&amp;nbsp; All you have to do is right-click on the project in &lt;STRONG&gt;Solution Explorer&lt;/STRONG&gt; and click &lt;STRONG&gt;Publish&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_10.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_10.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=423 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_thumb_4.png" width=548 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_thumb_4.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Troubleshooting the installation and deployment process is more transparent. Any errors that occur are now logged in the event viewer. For example, I deliberately installed the same Office solution twice to generate the following error in the event viewer. Developers commonly see this error when they build and debug an Office solution on their development computer, and then try to install the Office solution on the same development computer. To avoid this problem, use a different account to test the installer on the development computer, or use a different test computer. For more information about the event viewer, see &lt;A href="http://msdn.microsoft.com/en-us/library/cc442816.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc442816.aspx"&gt;Event Logging (2007 System)&lt;/A&gt;.&lt;/P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_4.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=576 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_thumb_1.png" width=585 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/BestPracticesforDeploymentwithVisualStud_D363/image_thumb_1.png"&gt;&lt;/A&gt; 
&lt;P&gt;Visual Studio 2008 SP1 also introduced ClickOnce manifests that do not need to be signed. However, Visual Studio Tools for Office relies on signed manifests to identify the publisher and determine if the Office solution is trusted.&amp;nbsp; Optional signing is a feature in VS2008 SP1 that does not apply to Office developers. For more information about trusting Office solutions, see &lt;A href="http://msdn.microsoft.com/en-us/library/bb772086.aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb772086.aspx"&gt;Granting Trust to Office Solutions (2007 System)&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Mary Lee, Programming Writer.&lt;/P&gt;
&lt;P&gt;Rachel Shaw, Program Manager.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9385465" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/ClickOnce/default.aspx">ClickOnce</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Mary+Lee/default.aspx">Mary Lee</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx">primary interop assemblies</category><category domain="http://blogs.msdn.com/vsto/archive/tags/.NET+Framework+Client+Profile/default.aspx">.NET Framework Client Profile</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Rachel+Schaw/default.aspx">Rachel Schaw</category></item><item><title>Office Programmability in Visual Basic and C# in VS 2010 (Beth Massi)</title><link>http://blogs.msdn.com/vsto/archive/2008/12/15/office-programmability-in-visual-basic-and-c-in-vs-2010-beth-massi.aspx</link><pubDate>Tue, 16 Dec 2008 00:39:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9222564</guid><dc:creator>VSTO Team</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9222564.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9222564</wfw:commentRss><description>&lt;p&gt;The Visual Basic team &lt;a href="http://blogs.msdn.com/vbteam/archive/2008/12/15/walkthrough-office-programmability-in-visual-basic-and-c-in-vs-2010-lisa-feigenbaum.aspx" target="_blank"&gt;posted a walkthrough today&lt;/a&gt; on some of the new language features in Visual Basic and C# to help with Office programmability in Visual Studio 2010. Specific features include adding optional parameters to C# 4.0 (VB already has this) and removing the dependency on the Primary Interop Assemblies (PIAs). &lt;/p&gt; &lt;p&gt;You can &lt;a href="https://connect.microsoft.com/VisualStudio/content/content.aspx?ContentID=9790" target="_blank"&gt;download the CTP&lt;/a&gt; and see it in action for yourself and &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vs2010ctpvbcs/thread/6172efc9-3075-4426-a773-cf2504f51dca" target="_blank"&gt;give feedback here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Enjoy,&lt;br&gt;-&lt;a href="http://blogs.msdn.com/bethmassi " target="_blank"&gt;Beth Massi&lt;/a&gt;, Visual Studio Community&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9222564" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx">primary interop assemblies</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Beth+Massi/default.aspx">Beth Massi</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2010/default.aspx">VS2010</category></item><item><title>Common Pitfalls during PIA Deployment and Installation (Mary Lee)</title><link>http://blogs.msdn.com/vsto/archive/2008/05/20/common-pitfalls-during-pia-deployment-and-installation.aspx</link><pubDate>Tue, 20 May 2008 22:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8524161</guid><dc:creator>VSTO Team</dc:creator><slash:comments>26</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8524161.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8524161</wfw:commentRss><description>&lt;P&gt;Deploying or installing the Office primary interop assemblies (PIAs) can sometimes be problematic. There are several common errors that occur when you try to deploy or install the PIAs.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Deployment pitfalls&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;A. &lt;EM&gt;Can I deploy the PIA DLL with my setup project?&lt;/EM&gt;&amp;nbsp; Yes, you can include the PIA DLL in your setup project, but we recommend that you use the &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&amp;amp;displaylang=en"&gt;Primary Interop Assemblies for the 2007 Microsoft Office system&lt;/A&gt; redistributable file from the Microsoft Download Center.&amp;nbsp; this way, the installer copies the PIAs into the GAC, and also installs binding redirects.&amp;nbsp; The binding redirects ensure that the latest version of the PIAs on the computer are always loaded.&amp;nbsp; This is how a solution developed for Microsoft Office 2003 still works on the 2007 Microsoft Office system.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Installation pitfalls&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;A. &lt;EM&gt;Do you have administrator privileges?&lt;/EM&gt; The account used to install the PIAs must have administrator privileges.&lt;/P&gt;
&lt;P&gt;B. &lt;EM&gt;Is the .NET Framework already installed?&lt;/EM&gt; The computer must have a version of the .NET Framework installed (version 1.1, 2.0, 3.0, or 3.5) before the PIA installer is run. Windows XP does not include any version of the .NET Framework unless .NET 1.1 was downloaded from Windows Update. Windows Vista does include a version of the .NET Framework. When Microsoft Office is first installed, the .NET Framework installation is detected and the PIAs are automatically installed.&lt;/P&gt;
&lt;P&gt;C. &lt;EM&gt;Is Business Contact Manager installed?&lt;/EM&gt; If Outlook 2007 with Business Contact Manager is already installed on the computer, you may see the following error message when you install the &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&amp;amp;displaylang=en"&gt;Primary Interop Assemblies for the 2007 Microsoft Office system&lt;/A&gt; from the Microsoft Download Center:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Error 1316: Setup cannot read from file {PATH}\PIARedist.MSI. Check your connection to the network, or CD-ROM drive. For other potential solutions, see SETUP.CHM. &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Business Contact Manager for Outlook 2007 installs the PIAs by default, and the file name is PIARedist.MSI.&amp;nbsp; However, the file from the Microsoft Download Center is called o2007pia.msi.&amp;nbsp; When you install the PIAs from the Microsoft Download Center, this name conflict causes the 1316 error.&lt;/P&gt;
&lt;P&gt;The easiest thing to do here is to just ignore the error, because this message means that the PIAs are already installed. If you want to correct the error, uninstall the PIAs through the list of installed programs for the specific computer. Then you can reinstall the PIAs with the &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&amp;amp;displaylang=en"&gt;Primary Interop Assemblies for the 2007 Microsoft Office system&lt;/A&gt; from the Microsoft Download Center.&lt;/P&gt;
&lt;P&gt;I don't recommend that you follow the workaround posted at &lt;A title=http://jlchereau.blogspot.com/2008/04/error-1316-when-installing-office-2007.html href="http://jlchereau.blogspot.com/2008/04/error-1316-when-installing-office-2007.html" mce_href="http://jlchereau.blogspot.com/2008/04/error-1316-when-installing-office-2007.html"&gt;Error 1316 when installing Office 2007 PIA’s&lt;/A&gt;, which changes the name of the o2007pia.msi file to piaredist.msi and updates the product.xml to point to piaredist.msi.&amp;nbsp; If you change the name of the o2007pia.msi, anyone that installs the PIAs after you will experience the 1316 error.&lt;/P&gt;
&lt;P&gt;If you discover other PIA pitfalls, please feel free to leave a comment or question so I can update this entry.&amp;nbsp; Thanks for reading!&lt;/P&gt;
&lt;P&gt;Mary Lee, programming writer.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8524161" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Mary+Lee/default.aspx">Mary Lee</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx">primary interop assemblies</category></item><item><title>Adding the Office Primary Interop Assemblies as a Prerequisite in your ClickOnce installer (Mary Lee)</title><link>http://blogs.msdn.com/vsto/archive/2008/05/08/adding-the-office-primary-interop-assemblies-as-a-prerequisite-in-your-clickonce-installer-mary-lee.aspx</link><pubDate>Fri, 09 May 2008 00:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8474669</guid><dc:creator>VSTO Team</dc:creator><slash:comments>45</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8474669.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8474669</wfw:commentRss><description>&lt;P&gt;When you use ClickOnce in Visual Studio 2008 to deploy your Office solution, you can include prerequisites such as the .NET Framework 3.5, the Visual Studio Tools for Office system 3.0 Runtime, and Windows Installer 3.1.&amp;nbsp; However, the primary interop assemblies (PIAs) for the 2007 Microsoft Office system are not automatically listed in the Prerequisites dialog box.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Fortunately, you can add the PIAs to the Prerequisites dialog box. The following procedure adds the 2007 Microsoft Office Primary Interop Assemblies to the Prerequisites Dialog Box. This procedure may look lengthy, but you only have to do it once.&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; Download the &lt;A href="http://go.microsoft.com/fwlink/?LinkId=83721" mce_href="http://go.microsoft.com/fwlink/?LinkId=83721"&gt;&lt;STRONG&gt;OfficeVSTO2005SEWindowsInstallerV3.msi&lt;/STRONG&gt;&lt;/A&gt; sample, which is part of the deployment whitepaper at &lt;A href="http://go.microsoft.com/fwlink/?LinkID=57779" mce_href="http://go.microsoft.com/fwlink/?LinkID=57779"&gt;Deploying Visual Studio 2005 Tools for Office Second Edition Solutions Using Windows Installer (Part 1 of 2)&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;2. Install OfficeVSTO2005SEWindowsInstallerV3.msi.&lt;/P&gt;
&lt;P&gt;3. Copy the contents of &lt;EM&gt;%ProgramFiles%\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample Version 3\packages&lt;/EM&gt; to &lt;EM&gt;%ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;4. Compile the component checker. This step checks if the computer has the correct version of Office installed to match the PIAs that are being installed.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;a) Open a Visual Studio command prompt&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;b) Change directories to &lt;EM&gt;%ProgramFiles%\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample Version 3\projects\Checks&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;c) Type the following command: &lt;FONT face="Courier New"&gt;cl.exe /Oxs /MT /GS ComponentCheck.cpp advapi32.lib&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;d) Copy ComponentCheck.exe to the &lt;EM&gt;%ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIA&lt;/EM&gt; folder and the &lt;EM&gt;%ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2003PIA&lt;/EM&gt; folder.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;5. Download and extract the Office 2007 PIAs from &lt;A href="http://go.microsoft.com/fwlink/?LinkId=72637" mce_href="http://go.microsoft.com/fwlink/?LinkId=72637"&gt;2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;6. Copy the o2007pia.msi file to the &lt;EM&gt;%ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIA&lt;/EM&gt; folder.&lt;/P&gt;
&lt;P&gt;7. In VS2008, on the &lt;STRONG&gt;Project&lt;/STRONG&gt; menu, click &lt;STRONG&gt;ProjectName Properties&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;8. Click the &lt;STRONG&gt;Publish&lt;/STRONG&gt; tab.&lt;/P&gt;
&lt;P&gt;9. Click the &lt;STRONG&gt;Prerequisites&lt;/STRONG&gt; button to open the Prerequisites dialog box.&lt;/P&gt;
&lt;P&gt;You should see the PIAs listed in the Prerequisites dialog box like the following image. Because the package.xml file does not define a HomeSite (a location to download the file), you will see a build warning.&amp;nbsp; Even if you have selected &lt;STRONG&gt;Download prerequisites from the component vendor's web site&lt;/STRONG&gt;, the PIAs will go into a directory alongside your solution installer.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/AddingtheOfficePrimaryInteropAssembliesa_D5CC/Prerequisites.jpg" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/AddingtheOfficePrimaryInteropAssembliesa_D5CC/Prerequisites.jpg"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=409 alt=Prerequisites src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/AddingtheOfficePrimaryInteropAssembliesa_D5CC/Prerequisites_thumb.jpg" width=522 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/AddingtheOfficePrimaryInteropAssembliesa_D5CC/Prerequisites_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;If you want to learn more about adding your own entries to the Prerequisites dialog box, see &lt;A href="http://msdn.microsoft.com/en-us/library/ms165429" mce_href="http://msdn.microsoft.com/en-us/library/ms165429"&gt;Adding Custom Prerequisites&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;For more information about common problems when deploying the Office&amp;nbsp;primary interop assemblies, see&amp;nbsp;&lt;A href="http://blogs.msdn.com/vsto/archive/2008/05/20/common-pitfalls-during-pia-deployment-and-installation.aspx"&gt;http://blogs.msdn.com/vsto/archive/2008/05/20/common-pitfalls-during-pia-deployment-and-installation.aspx&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;For troubleshooting assistance, try the &lt;A class="" href="http://blogs.msdn.com/andreww/archive/2008/02/21/vsto-vsta-power-tools-v1-0.aspx" mce_href="http://blogs.msdn.com/andreww/archive/2008/02/21/vsto-vsta-power-tools-v1-0.aspx"&gt;VSTO Power Tools&lt;/A&gt;, a suite of tools to help you develop and deploy Office solutions. For example, you can use the VSTO Troubleshooter to examine end user computers for missing prerequisites.&lt;/P&gt;
&lt;P&gt;Mary Lee, programming writer.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8474669" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/ClickOnce/default.aspx">ClickOnce</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Mary+Lee/default.aspx">Mary Lee</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO+Power+Tools/default.aspx">VSTO Power Tools</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx">primary interop assemblies</category></item></channel></rss>