-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathProgram.cs
More file actions
51 lines (45 loc) · 1.47 KB
/
Program.cs
File metadata and controls
51 lines (45 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Text;
using dotnetCampus.Configurations;
using dotnetCampus.DotNETBuild.Context;
using dotnetCampus.DotNETBuild.Utils;
namespace DotNETTask
{
class Program
{
static void Main(string[] args)
{
var appConfigurator = AppConfigurator.GetAppConfigurator();
var compileConfiguration = appConfigurator.Of<CompileConfiguration>();
// 用于替换的列表
var replaceDictionary = new Dictionary<string, string>()
{
{ "$(AppVersion)", compileConfiguration.AppVersion }
};
// 替换一些变量,然后原原本本传入到 dotnet 命令里面
var argsString = new StringBuilder();
foreach (var arg in args)
{
var temp = arg;
if (replaceDictionary.TryGetValue(temp, out var replaceValue))
{
temp = replaceValue;
}
temp = ProcessCommand.ToArgumentPath(temp);
argsString.Append(temp);
argsString.Append(' ');
}
Log.Info($"dotnet {argsString}");
var (success, output) = ProcessCommand.ExecuteCommand("dotnet", argsString.ToString());
if (success)
{
Log.Info(output);
}
else
{
Log.Error(output);
}
}
}
}