这是正常的,如果我指定的“输出类型” VS忽略了此设置由GitVersion别名返回的对象是不同的?对象从GitVersion不一致返回
如果我指定输出类型,则返回的对象的属性都是“空”,但是当我省略了设置,属性被设置为期望的值
例如:
Task("Version")
.Does(() =>
{
var versionInfo = GitVersion(new GitVersionSettings()
{
UpdateAssemblyInfo = true,
OutputType = GitVersionOutput.BuildServer
});
Information("MajorMinorPatch: {0}", versionInfo.MajorMinorPatch);
Information("FullSemVer: {0}", versionInfo.FullSemVer);
Information("InformationalVersion: {0}", versionInfo.InformationalVersion);
Information("LegacySemVer: {0}", versionInfo.LegacySemVer);
Information("Nuget v1 version: {0}", versionInfo.NuGetVersion);
Information("Nuget v2 version: {0}", versionInfo.NuGetVersionV2);
});
输出是:
MajorMinorPatch: [NULL]
FullSemVer: [NULL]
InformationalVersion: [NULL]
LegacySemVer: [NULL]
Nuget v1 version: [NULL]
Nuget v2 version: [NULL]
如果我改变我的任务,像这样:
Task("Version")
.Does(() =>
{
var versionInfo = GitVersion(new GitVersionSettings()
{
UpdateAssemblyInfo = false
});
Information("MajorMinorPatch: {0}", versionInfo.MajorMinorPatch);
Information("FullSemVer: {0}", versionInfo.FullSemVer);
Information("InformationalVersion: {0}", versionInfo.InformationalVersion);
Information("LegacySemVer: {0}", versionInfo.LegacySemVer);
Information("Nuget v1 version: {0}", versionInfo.NuGetVersion);
Information("Nuget v2 version: {0}", versionInfo.NuGetVersionV2);
});
的输出是:
MajorMinorPatch: 0.1.0
FullSemVer: 0.1.0+1
InformationalVersion: 0.1.0+1.Branch.master.Sha.5b2
LegacySemVer: 0.1.0
Nuget v1 version: 0.1.0
Nuget v2 version: 0.1.0
这个“设计”似乎违反了最小惊讶的原则,我 – Schneider
我不反对。这里的“设计”是在Cake中没有任何事情可以做,没有在GitVersion中首先进行更改。一旦完成,Cake将使用新功能,并根据需要返回变量。 –