gpt4 book ai didi

c# - 在 MSBuild .targets 中创建集合变量

转载 作者:太空宇宙 更新时间:2023-11-03 13:51:30 28 4
gpt4 key购买 nike

上下文

存在一个烦人的 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 属性?

最佳答案

我遇到了这个问题。这显然是因为我将引用“Microsoft.Office.Tools.Common.v4.0.Utilities”上的“复制本地”设置从 True 更改为 False。

我已将一个项目从 VS2012 升级到 VS2013,并注意到该引用是唯一设置为“Copy Local = True”的引用。所以我把它设置为假。因为它不一样。

关于c# - 在 MSBuild .targets 中创建集合变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13569813/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com