【发布时间】:2012-11-26 17:16:59
【问题描述】:
上下文
存在一个烦人的 Excel 加载项编译错误,我目前能够解决它的唯一方法是编辑 VSTO MSBuild .targets 文件
- C:\Program Files\MSBuild\Microsoft\VisualStudio\v11.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets
通过以下修改,我可以编译 Excel 加载项,但副作用是不再显示我的自定义功能区。
这里详细描述了 VSTO 错误和解决方法:"FindRibbons" task failed unexpectedly
.targets 修改具有空 RibbonTypes 的不良副作用
<!-- This part is causing the compilation to fail and has to be commented out -->
<!-- <FindRibbons-->
<!-- AssemblyName="$(AbsolutePathToCustomization)"-->
<!-- TargetFramework="$(TargetFrameworkVersion)"-->
<!-- >-->
<!-- <Output TaskParameter="RibbonTypes" ItemName="RibbonTypesCollection"/>-->
<!-- </FindRibbons>-->
<!-- Now RibbonTypes is empty, causing the side-effect-->
<!-- Used to be RibbonTypes="@(RibbonTypesCollection)"-->
<!-- Can I manually recreate @(RibbonTypesCollection)?-->
<GenerateOfficeDocumentManifest Condition="'$(VSTO_ProjectType)' == 'Document'"
SolutionID="$(SolutionID)"
RibbonTypes=""
TargetFramework="$(TargetFrameworkVersion)"
>
手动填写参数?
现在我需要提供如下内容
“ProjectNamespace.RibbonName, AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”
- 但我不确切知道数据必须采用什么形式,而且我也不知道 MSBuild 语法?
- 如何手动填充 RibbonTypes 属性?
【问题讨论】:
-
链接中提到的其他解决方法无效?
-
@KMoraz 不,尝试了所有其他方法,但没有一个对我有用
标签: c# visual-studio msbuild vsto build-process