Skip to content

Commit 3cee019

Browse files
committed
尝试兼容多个版本命令行
1 parent 7b506c7 commit 3cee019

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Code/UsingMSBuildCopyOutputFileToFastDebug/Program.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Linq;
23
using dotnetCampus.Cli;
34
using dotnetCampus.MSBuildUtils;
45

@@ -17,6 +18,17 @@ static void Main(string[] args)
1718
}
1819
#endif
1920

21+
if (args[0] == "--")
22+
{
23+
// 为了兼容旧版本,依然使用如下格式
24+
// dotnet foo.dll -- --a 1 --b ab
25+
// 在 .NET 6 将会让 -- 作为第一个参数,因此需要去掉
26+
var list = args.ToList();
27+
list.RemoveAt(0);
28+
args = list.ToArray();
29+
// 还好上面代码不在乎性能,让我试试这个逗比方法
30+
}
31+
2032
CommandLine.Parse(args).AddHandler<CleanOptions>(c =>
2133
{
2234
Logger.Message($"Enter CleanOptions");

build/Version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>1.3.207</Version>
3+
<Version>1.3.211</Version>
44
</PropertyGroup>
55
</Project>

0 commit comments

Comments
 (0)