我已经开发了名为ExportSolution的自定义MSBuild任务,我需要将自定义的enum PackageType值传递给它.
该PackageType很简单:
public enum PackageType
{
Managed,
Unmanaged,
Both
}
Run Code Online (Sandbox Code Playgroud)
MSBuild脚本也很简单:
<Target Name="ExportSolution" DependsOnTargets="BuildTasksDll">
<Message Text="Exporting solution '$(SolutionName)' to '$(SolutionPath)'" />
<ExportSolution SolutionName="$(SolutionName)" PackageType="Both"></ExportSolution>
</Target>
Run Code Online (Sandbox Code Playgroud)
但是,为该目标运行脚本我收到以下错误消息:
错误MSB4030:"Both"是"ExportSolution"任务的"PackageType"参数的无效值."PackageType"参数的类型为"Tasks.Common.PackageType".
我应该以哪种格式将值传递给PackageType的变量以使此代码有效?
小智 0
我会像这样重构枚举。
public enum PackageType
{
Managed = 0,
Unmanaged = 1,
Both = 2
}
Run Code Online (Sandbox Code Playgroud)
然后我将编辑构建脚本以使用整数作为选择方法。
<ExportSolution SolutionName="$(SolutionName)" PackageType=2></ExportSolution>
Run Code Online (Sandbox Code Playgroud)
这可能不是您正在寻找的解决方案,但它可能适合您的需要。
| 归档时间: |
|
| 查看次数: |
793 次 |
| 最近记录: |