我在 Visual Studio 2015 中使用Word 2013 和 2016 VSTO 加载项模板创建了一个新的 C# 项目。我没有对自动生成的项目代码进行任何更改,以便查看它将如何在我的 TFS 2015 Build 上构建服务器。构建产生以下错误:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets (315, 0)
“SetOffice2007AddInRegistration”任务意外失败。System.Runtime.InteropServices.COMException (0x800703F0):尝试引用不存在的令牌。(来自 HRESULT 的异常:0x800703F0)在 Microsoft.VisualStudio.Tools.Office.Runtime.Interop.VSTOEENativeMethods.GetSolutionMetadata(String solutionInfoString) 在 Microsoft.VisualStudio.Tools.Office.Runtime.Interop.VSTOEENativeMethods.GetVSTOEEHandle() 在 Microsoft.VisualStudio。 Microsoft.VisualStudio.Tools.Office.Runtime.AddInRegistryKeyManager.RegisterAddIn 上的 Tools.Applications.OfficeSolutionMetadata..ctor(字符串 manifestLocation)(Uri manifestUri,字符串 addInName,字符串 officeApplication,字符串friendlyName,字符串描述,Int32 loadBehavior,字符串 compatibleFrameworkXML,布尔 runLocal ) 在 Microsoft.VisualStudio.Tools.Office。
构建服务作为域帐户运行,该域帐户是安装了构建服务的 Windows Server 2012 的管理员。Visual Studio 2015 和 Office 2016 安装在此 Windows Server 上。
当我在本地 PC 上的 Visual Studio 2015 中构建项目时,我完全没有错误。如果您在工作中遇到同样的问题,请提供帮助。谢谢你。