镇江外贸网站建设,创意产品设计作品图片,seo是干啥的,如何做网站推广页面在上篇博客[Cake] 1. CI中的Cake中介绍了如何在CI中利用Cake来保持与CI/CD环境的解耦。当时dotnet 2.1还未正式发布#xff0c;dotnet 还没有工具的支持#xff0c;使得安装cake非常麻烦。不过随着 dotnet tool 的加入#xff0c;这一问题得到了很好的解决。目前安装cakedotnet 还没有工具的支持使得安装cake非常麻烦。不过随着 dotnet tool 的加入这一问题得到了很好的解决。目前安装cake0.30.0版本之后只需要一行命令即可1 dotnet tool install -g cake.tool然后就可以使用cake了。用 dotnet cake 或者 dotnet-cake 都可以推荐使用前者。 1 $ dotnet cake --help 2 3 Usage: Cake.exe [script] [--verbosityvalue] 4 [--showdescription] [--dryrun] [..] 5 6 Example: Cake.exe 7 Example: Cake.exe build.cake --verbosityquiet 8 Example: Cake.exe build.cake --showdescription 9 10 Options:11 --verbosityvalue Specifies the amount of information to be displayed.12 (Quiet, Minimal, Normal, Verbose, Diagnostic)13 --debug Performs a debug.14 --showdescription Shows description about tasks.15 --showtree Shows the task dependency tree.16 --dryrun Performs a dry run.17 --exclusive Execute a single task without any dependencies.18 --bootstrap Download/install modules defined by #module directives19 --version Displays version information.20 --info Displays additional information about Cake execution.21 --help Displays usage information.上一篇博客[Cake] 1. CI中的Cake中出现的cake的引导脚本 build.ps1 和 build.sh 绝大部分代码都是在下载安装cake用的既然有了上面的 dotnet tool 命令可以安装cake那么当然也就可以简化一下了。引导脚本中包含安装和执行命令的代码。nuget相关的环境变量是项目需要的cake脚本可以读取这些信息来使用。2.1 cake.ps1 1 [string]$SCRIPT 0-build/build.cake 2 [string]$CAKE_VERSION 0.33.0 3 4 # nuget server config 5 $ENV:NUGET_REPOSITORY_API_URL http://nuget-server.test/nuget 6 $ENV:NUGET_REPOSITORY_API_KEY 123456 7 8 # Install cake.tool 9 dotnet tool install --global cake.tool --version $CAKE_VERSION10 11 # Start Cake12 [string]$CAKE_ARGS -verbositydiagnostic13 14 Write-Host dotnet cake $SCRIPT $CAKE_ARGS $ARGS -ForegroundColor GREEN15 16 dotnet cake $SCRIPT $CAKE_ARGS $ARGS查看一下cake脚本都有哪些task 1 $ .\cake.ps1 --showtree 2 Tool cake.tool is already installed. 3 dotnet cake 0-build/build.cake -verbositydiagnostic --showtree 4 5 .... 6 7 default 8 └─test 9 └─build10 ├─clean11 └─restore12 13 push14 └─pack15 └─test16 └─build17 ├─clean18 └─restore2.2 cake.sh 1 #!/bin/sh 2 3 SCRIPT0-build/build.cake 4 CAKE_VERSION0.33.0 5 6 # nuget server config 7 export NUGET_REPOSITORY_API_URLhttp://nuget-server.test/nuget 8 export NUGET_REPOSITORY_API_KEY123456 9 10 # Install cake.tool11 dotnet tool install --global cake.tool --version $CAKE_VERSION12 export PATH$PATH:$HOME/.dotnet/tools13 14 # Start Cake15 CAKE_ARGS$SCRIPT -verbositydiagnostic16 17 echo \033[32mdotnet cake $CAKE_ARGS $18 19 dotnet cake $CAKE_ARGS $CI/CD的yaml配置文件不用做调整只需执行对 cake.sh 或者 cake.ps1 的调用即可。这也是cake带来的避免在CI/CD中编程的好处所有的逻辑都位于cake脚本中。dotnet tool https://docs.microsoft.com/zh-cn/dotnet/core/tools/dotnet-tool-installcake 示例项目 https://github.com/linianhui/cake.example原文地址https://www.cnblogs.com/linianhui/p/cake-with-dotnet-tool.html.NET社区新闻深度好文欢迎访问公众号文章汇总 http://www.csharpkit.com