标签:源代码 ack task cas csdn post star ret because
关于dotnet跨平台的相关内容。能够參考:跨平台.NET Core--微软开源方向
当中。.net core基础库叫CoreFX:https://github.com/dotnet/corefx,.net core执行时叫CoreCLR:https://github.com/dotnet/coreCLR, asp.net core各组件库:https://github.com/aspnet。
源代码在:https://github.com/dotnet/cli/tree/rel/1.0.0/src/dotnet/commands/dotnet-restore
入口在这里:https://github.com/dotnet/cli/blob/rel/1.0.0/src/dotnet/commands/dotnet-restore/Program.cs
主要是寻找当前文件夹下的项目文件(project.json),然后利用NuGet库还原整个项目的依赖库,然后遍历每一个文件夹,生成项目文件,继续还原该项目文件里的依赖项:
public static int Run(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
var app = new CommandLineApplication(false)
{
Name = "dotnet restore",
FullName = ".NET project dependency restorer",
Description = "Restores dependencies listed in project.json"
};
// Parse --quiet, because we have to handle that specially since NuGet3 has a different
// "--verbosity" switch that goes BEFORE the command
var quiet = args.Any(s => s.Equals("--quiet", StringComparison.OrdinalIgnoreCase));
args = args.Where(s => !s.Equals("--quiet", StringComparison.OrdinalIgnoreCase)).ToArray();
app.OnExecute(() =>
{
try
{
var projectRestoreResult = NuGet3.Restore(args, quiet);
var restoreTasks = GetRestoreTasks(args);
foreach (var restoreTask in restoreTasks)
{
var project = ProjectReader.GetProject(restoreTask.ProjectPath);
RestoreTools(project, restoreTask, quiet);
}
return projectRestoreResult;
}
catch (InvalidOperationException e)
{
Console.WriteLine(e.Message);
return -1;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return -2;
}
});
return app.Execute(args);
}源代码在:https://github.com/dotnet/cli/tree/rel/1.0.0/src/dotnet/commands/dotnet-run
入口在这里:https://github.com/dotnet/cli/blob/rel/1.0.0/src/dotnet/commands/dotnet-run/Program.cs
主要是參数处理。真正的实如今:https://github.com/dotnet/cli/blob/rel/1.0.0/src/dotnet/commands/dotnet-run/RunCommand.cs, 假设是交互的就直接执行,否则编译然后执行。
----------------------------------------------------------RunCommand.cs----------------------------------------------------------
public int Start()
{
if (IsInteractive())
{
return RunInteractive(Project);
}
else
{
return RunExecutable();
}
}【dotnet跨平台】"dotnet restore"和"dotnet run"都做了些什么?
标签:源代码 ack task cas csdn post star ret because
原文地址:http://www.cnblogs.com/jhcelue/p/7201925.html