public static void PublishProjects(this ICakeContext context, Configuration config, string rootFolder, string destination, string[] excludePatterns, string projectParentFolderName) { var globberSettings = new GlobberSettings(); bool excludes(IFileSystemInfo fileSystemInfo) => !excludePatterns.Any(s => fileSystemInfo.Path.FullPath.Contains(s)); globberSettings.FilePredicate = excludes; var projects = GlobbingAliases.GetFiles(context, $"{rootFolder}\\**\\{projectParentFolderName}\\*.csproj", globberSettings); context.Log.Information("Publishing " + rootFolder + " to " + destination); foreach (var project in projects) { context.MSBuild(project, cfg => InitializeMSBuildSettingsInternal(context, config, cfg) .WithTarget(config.BuildTargets) .WithProperty("DeployOnBuild", "true") .WithProperty("DeployDefaultTarget", "WebPublish") .WithProperty("WebPublishMethod", "FileSystem") .WithProperty("DeleteExistingFiles", "false") .WithProperty("publishUrl", destination) .WithProperty("BuildProjectReferences", "false") ); } }
public override void Run(Context context) { // Copy packages to build/artifacts/packages var packages = GlobbingAliases.GetFiles(context, "./source/**/*.symbols.nupkg"); foreach (var package in packages) { context.CopyFileToDirectory(package, context.PackagesDir); } // Publish packages if (context.ShouldPublish) { foreach (var package in packages) { DotNetCoreAliases.DotNetCoreNuGetPush( context, package.FullPath, new DotNetCoreNuGetPushSettings() { ArgumentCustomization = args => args.Append("/nodeReuse:False"), Source = "https://www.example.com/nugetfeed", ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a", }); } } else { context.Information("Publishing skipped"); } }
public override void Run(Context context) { var projects = GlobbingAliases.GetFiles(context, "./source/*.Tests/*.csproj"); foreach (var project in projects) { var testSettings = new DotNetCoreTestSettings { ArgumentCustomization = args => args.Append("/nodeReuse:False").Append("/m"), Configuration = context.Configuration, Collectors = new List <string>() { "XPlat Code Coverage" }, Loggers = new List <string>() { "trx", }, ResultsDirectory = context.TestResultsDir, }; if (context.MsBuildDebug) { testSettings.ArgumentCustomization = args => args.Append($"/bl:{context.MsBuildTestLogFile}"); } var coverletSettings = new CoverletSettings() { CoverletOutputDirectory = context.CoverageDir, CoverletOutputFormat = CoverletOutputFormat.cobertura, Verbosity = Cake.Common.Tools.DotNetCore.DotNetCoreVerbosity.Diagnostic, }; CoverletAliases.DotNetCoreTest( context, project, testSettings, coverletSettings); } }