从Office 2013升级到Office 2016后,未加载Excel VSTO项目 [英] Excel VSTO project not loading after upgrading from Office 2013 to Office 2016
问题描述
我在使用VS 2013加载项目时遇到以下错误(安装了Office 2016)
无法创建项目,因为与此项目类型关联的应用程序是没有安装在这台电脑上。
您必须安装与此项目类型关联的Microsoft Office应用程序。
C#项目最初是作为Excel工作簿创建的,使用VS 2013与Office 2013和运行时作为'Visual Studio 2010工具for Office
Runtime'。 .Net Framework也没有改变。
当我查看.csproj文件时,我发现以下对Office Dll,Office版本和ProjectProperties部分的引用是指向升级到Office 2016后不存在的C:\Program Files \ Microsoft Office \ Office15 \ Excel Excel。
所有的东西都是我需要在.csproj文件中手动修复才能加载项目?
< ItemGroup>
&NBSP; < Reference Include =" stdole,Version = 7.0.3300.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a">
&NBSP; &NBSP; < Private> False< / Private>
&NBSP; < /参考>
&NBSP; < Reference Include =" Office,Version = 15.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c">
&NBSP; &NBSP; < Private> False< / Private>
&NBSP; &NBSP; < EmbedInteropTypes> true< / EmbedInteropTypes>
&NBSP; < /参考>
&NBSP; < Reference Include =" Microsoft.Vbe.Interop,Version = 15.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c">
&NBSP; &NBSP; < Private> False< / Private>
&NBSP; &NBSP; < EmbedInteropTypes> true< / EmbedInteropTypes>
&NBSP; < /参考>
&NBSP; < Reference Include =" Microsoft.Office.Interop.Excel,Version = 15.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c">
&NBSP; &NBSP; < Private> False< / Private>
&NBSP; &NBSP; < EmbedInteropTypes> true< / EmbedInteropTypes>
&NBSP; < /参考>
< / ItemGroup>
< ProjectProperties HostName =" Workbook.xlsx" HostPackage = QUOT; {3F2B7691-D1D1-402F-9370-2704A737CF60}" OfficeVersion = QUOT; 15.0" VstxVersion = QUOT; 4.0" ApplicationType = QUOT; XLS"语言= QUOT; CS" TemplatesPath = QUOT; VSTOTemplates"
DebugInfoExeName =" C:\Program Files \ Microsoft Office \ Office5 \ Excel.exe" DebugInfoCommandLine =" / x& quot; [$ OUTPUT] Workbook.xlsx& quot;" />
>>>无法创建项目,因为与此项目类型关联的应用程序不是安装在这台电脑上。您必须安装与此项目类型关联的Microsoft Office应用程序。
根据您的描述,您可以替换HostPackage =" {3F2B7691-D1D1-402F- 9370-2704A737CF60}" with HostPackage =" {29A7B9D7-A7F1-4328-8EF0-6B2D1A56B2C1}"。
有关详细信息,请单击
在这里以提及Office解决方案中的故障排除错误
I get the below error on loading the project with VS 2013 (with Office 2016 installed)
Cannot create the project because the application associated with this project type is not installed on this computer. You must install the Microsoft Office application that is associated with this project type.
The C# project was originally created as Excel Workbook using VS 2013 with Office 2013 and runtime as 'Visual Studio 2010 Tools for Office Runtime'. .Net Framework has also not changed.
When I looked inside the .csproj file, I found the below references to Office Dll's, Office versions and the ProjectProperties section was pointing to C:\Program Files\Microsoft Office\Office15\Excel.exe which does not exist after the upgrading to Office 2016.
What are all the things that i need to manually repair within the .csproj file to get the project loading?
<ItemGroup><Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>False</Private>
</Reference>
<Reference Include="Office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<Private>False</Private>
<EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.Vbe.Interop, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<Private>False</Private>
<EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<Private>False</Private>
<EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>
</ItemGroup>
<ProjectProperties HostName="Workbook.xlsx" HostPackage="{3F2B7691-D1D1-402F-9370-2704A737CF60}" OfficeVersion="15.0" VstxVersion="4.0" ApplicationType="XLS" Language="CS" TemplatesPath="VSTOTemplates" DebugInfoExeName="C:\Program Files\Microsoft Office\Office15\Excel.exe" DebugInfoCommandLine="/x "[$OUTPUT]Workbook.xlsx"" />
>>>Cannot create the project because the application associated with this project type is not installed on this computer. You must install the Microsoft Office application that is associated with this project type.
According to your description, you could replace HostPackage="{3F2B7691-D1D1-402F-9370-2704A737CF60}" with HostPackage="{29A7B9D7-A7F1-4328-8EF0-6B2D1A56B2C1}".
For more information, click here to refer about Troubleshooting Errors in Office Solutions
这篇关于从Office 2013升级到Office 2016后,未加载Excel VSTO项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!