本文整理汇总了C#中FullPath.CombineWith方法的典型用法代码示例。如果您正苦于以下问题:C# FullPath.CombineWith方法的具体用法?C# FullPath.CombineWith怎么用?C# FullPath.CombineWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FullPath
的用法示例。
在下文中一共展示了FullPath.CombineWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TargetPackage
private static void TargetPackage(ITaskContext context)
{
FullPath packagesDir = new FullPath(context.Properties.Get(BuildProps.ProductRootDir, "."));
packagesDir = packagesDir.CombineWith(context.Properties.Get<string>(BuildProps.BuildDir));
FullPath simplexPackageDir = packagesDir.CombineWith("Detergent");
FileFullPath zipFileName = packagesDir.AddFileName(
"Detergent-{0}.zip",
context.Properties.Get<Version>(BuildProps.BuildVersion));
StandardPackageDef packageDef = new StandardPackageDef("Detergent", context);
VSSolution solution = context.Properties.Get<VSSolution>(BuildProps.Solution);
VSProjectWithFileInfo projectInfo =
(VSProjectWithFileInfo)solution.FindProjectByName("Detergent");
LocalPath projectOutputPath = projectInfo.GetProjectOutputPath(
context.Properties.Get<string>(BuildProps.BuildConfiguration));
FullPath projectTargetDir = projectInfo.ProjectDirectoryPath.CombineWith(projectOutputPath);
packageDef.AddFolderSource(
"bin",
projectTargetDir,
false);
ICopier copier = new Copier(context);
CopyProcessor copyProcessor = new CopyProcessor(
context,
copier,
simplexPackageDir);
copyProcessor
.AddTransformation("bin", new LocalPath(string.Empty));
IPackageDef copiedPackageDef = copyProcessor.Process(packageDef);
Zipper zipper = new Zipper(context);
ZipProcessor zipProcessor = new ZipProcessor(
context,
zipper,
zipFileName,
simplexPackageDir,
null,
"bin");
zipProcessor.Process(copiedPackageDef);
}
示例2: TargetNuGet
private static void TargetNuGet(ITaskContext context, string nugetId)
{
FullPath packagesDir = new FullPath(context.Properties.Get(BuildProps.ProductRootDir, "."));
packagesDir = packagesDir.CombineWith(context.Properties.Get<string>(BuildProps.BuildDir));
string sourceNuspecFile = string.Format(
CultureInfo.InvariantCulture,
@"{0}\{0}.nuspec",
nugetId);
FileFullPath destNuspecFile = packagesDir.AddFileName("{0}.nuspec", nugetId);
context.WriteInfo("Preparing the {0} file", destNuspecFile);
ExpandPropertiesTask task = new ExpandPropertiesTask(
sourceNuspecFile,
destNuspecFile.ToString(),
Encoding.UTF8,
Encoding.UTF8);
task.AddPropertyToExpand("version", context.Properties.Get<Version>(BuildProps.BuildVersion).ToString());
task.Execute(context);
// package it
context.WriteInfo("Creating a NuGet package file");
RunProgramTask progTask = new RunProgramTask(@"lib\NuGet\NuGet.exe");
progTask.SetWorkingDir(destNuspecFile.Directory.ToString());
progTask
.AddArgument("pack")
.AddArgument(destNuspecFile.FileName)
.AddArgument("-Verbose")
.Execute(context);
string nupkgFileName = string.Format(
CultureInfo.InvariantCulture,
"{0}.{1}.nupkg",
nugetId,
context.Properties.Get<Version>(BuildProps.BuildVersion));
context.WriteInfo("NuGet package file {0} created", nupkgFileName);
string apiKeyFileName = "NuGet API key.txt";
if (!File.Exists(apiKeyFileName))
{
context.WriteInfo("'NuGet API key.txt' does not exist, cannot publish the package.");
return;
}
string apiKey = File.ReadAllText(apiKeyFileName);
// publish the package file
context.WriteInfo("Pushing the NuGet package to the repository");
progTask = new RunProgramTask(@"lib\NuGet\NuGet.exe");
progTask.SetWorkingDir(destNuspecFile.Directory.ToString());
progTask
.AddArgument("push")
.AddArgument(nupkgFileName)
.AddArgument(apiKey)
.AddArgument("-Source")
.AddArgument("http://packages.nuget.org/v1/")
.Execute(context);
}