DevOpsTargets 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DevOpsTargets --version 1.1.1
NuGet\Install-Package DevOpsTargets -Version 1.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DevOpsTargets" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DevOpsTargets --version 1.1.1
#r "nuget: DevOpsTargets, 1.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DevOpsTargets as a Cake Addin
#addin nuget:?package=DevOpsTargets&version=1.1.1

// Install DevOpsTargets as a Cake Tool
#tool nuget:?package=DevOpsTargets&version=1.1.1

devops-targets

Nuget downloads Nuget Build status License: MIT

This are helper deployment scripts used for building, testing deploying application with .NET script or .NET SDK app.

Use with dotnet script;

#! "net5.0"
#r "nuget:DevOpsTargets"

using System.IO;
using static Bullseye.Targets;
using static DevOpsTargets.Targets;

var pathToApp = Path.Combine(GetScriptFolder(), "MyApp");
Target("check-version", "Check .NET CLI version", () => Shell("dotnet --version"));
Target("build", "Build .NET App", DependsOn("check-version"), () => DotNet.Build(pathToApp));
RunAndExit(Args);

Methods

using static DevOpsTargets.Targets;

// Run all Bullseye Targets with the System.CommandLine library.
RunAndExit(IEnumerable<string> args, string loggerPrefix);  // void

// Get current script directory
GetScriptFolder();  // string

// Create directory if not exists
EnsureDirectoryExists(string path);  // void

// Remove and re-create directory.
CleanDirectory(string path);  // void

// Delete all passed paths
DeleteAllFilesAndFolders(params string[] paths);  // void

// Write messages to the output.
Write(string message, LogLevel logLevel = LogLevel.Message);  // void

// Write messages to the output on a new line.
WriteLine(string message, LogLevel logLevel = LogLevel.Message);  // void

// Start a shell command for the current OS.
ShellCommand(string command, string workingDirectory = null, LogLevel outputLogLevel = LogLevel.Verbose, bool doubleEscapeLinux = true);  // Command

// Start a shell command for the current OS and wait result.
Shell(string command, string workingDirectory = null, LogLevel outputLogLevel = LogLevel.Verbose);  // string

// Start a shell command for the current OS and wait result if test command fail.
ShellInstall(string testCommand, string installCommand, string workingDirectory = null, LogLevel outputLogLevel = LogLevel.Verbose);  // string

// Merge transform .json into another .json
Transform.TransformSettingsJson(string pathToSettingsJson, string pathToTransformJson);  // void

// Find value of a property in json.
Transform.FindPropertyValueInJson(string pathToJson, string propertyName);  // string

// Find value in XML by xpath
Transform.GetXmlXPathValue(string pathToXml, string xpath);  // string

// Replace ${value} in a text file
Transform.ReplaceInFile(string pathToFile, string pathToNewFile, params EnvValue[] values);  // void

// Build csproj file
DotNet.Build(string pathToProject, string configuration = "Debug");  // void

// Publish csproj file
DotNet.Publish(string pathToProject, string pathToOutput, string configuration = "Release");  // void

// Test csproj file
DotNet.Test(string pathToProject, string configuration = "Debug", string pathToOutput = null);  // void

// Test with coverage csproj file
DotNet.TestWithCoverage(string pathToProject, string pathToOutput, string configuration = "Debug", TestCoverageFormat formats = TestCoverageFormat.Cobertura, params TestLogInfo[] loggers);  // void

// Install NodeJs version if  NodeJs was never installed.
NodeJs.Install(string version);  // void

// Execute `npm install` in folder.
Npm.Install(string pathToFolder);  // void

// Execute `npm ci --no-optional ..` in folder.
Npm.Ci(string pathToFolder, string cacheFolder = null");  // void

// Install npm package globally is not already installed. Example InstallGlobal("@angular/cli");
Npm.InstallGlobal(string package);  // void

// Run NPM command.
Npm.Run(string command, string pathToFolder);  // void

Also see samples/.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.2 10,573 11/17/2021
1.2.1 872 11/16/2021
1.2.0 248 11/15/2021
1.1.1 971 9/16/2021
1.1.0 213 9/16/2021
1.0.0 472 8/2/2021
0.3.0 183 7/7/2021
0.2.0 184 7/7/2021
0.1.0 227 7/6/2021