-
Notifications
You must be signed in to change notification settings - Fork 1
GenerateNuGetSpecTask
guryanovev edited this page Dec 27, 2016
·
10 revisions
Generates .nuspec file according to the NuGet spec.
Input | Output file path, package metadata, package dependencies, package file |
Output | none |
ITaskFuture<Nothing> generateNuSpec = Task(
"GenerateNuSpec",
new GenerateNuGetSpecTask(root/"Artifacts"/"MyPackage.nuspec") // output path
.Id("MyPackage") // package ID
.Description("My package description")
.WithFile("C:\\MyPachakeTool.exe", "tools") // adding single file
.WithFiles(GetContentFiles(), "content") // adding multiple files
.WithDependency("Foo.Dependency", "1.0.0.0"));
Output IFile instance is passed as a required constructor argument:
IFile nuspec = root/"Artifacts"/"MyPackage.nuspec";
ITaskFuture<Nothing> generateNuSpec = Task(
"GenerateNuSpec",
new GenerateNuGetSpecTask(nucpec));
Package metadata properties could be set using fluent interface methods:
ITaskFuture<Nothing> generateNuSpec = Task(
"GenerateNuSpec",
new GenerateNuGetSpecTask(nucpec)
.Id("MyPackageID")
.Version("1.0.0.0")
.Title("My package")
.Authors("Author1", "Author2"),
.Owners("Owner1", "Owner2")
.Description("My package description")
.ReleaseNotes("My package release notes")
.Summary("My package summary")
.Language("LOCALE_ID") // string or System.Globalization.CultureInfo
.ProjectUrl("http://example.com")
.IconUrl("http://example.com")
.LicenseUrl("http://example.com")
.Copyright("text")
.RequireLicenseAcceptance(true)
.Tags("dotNet", "performance"));
There are two options for setting dependencies:
- configure it manually or
- read it from a specific project (packages.config) file.
Manual configuration:
ITaskFuture<Nothing> generateNuSpec = Task(
"GenerateNuSpec",
new GenerateNuGetSpecTask(nucpec)
.WithDependency(
"Common.Logging", // dependency ID
"3.2.0.0", // dependency version (optional)
"net45")); // frameworkVersion (optional)
Reading from a project's packages.config file:
IFile packagesConfig = root/"Src"/"MyProject"/"packages.config";
ITaskFuture<Nothing> generateNuSpec = Task(
"GenerateNuSpec",
new GenerateNuGetSpecTask(nucpec)
.WithDependenciesFromPackagesConfig(packagesConfig);
or from project directory:
IDirectory projectDir = root/"Src"/"MyProject";
ITaskFuture<Nothing> generateNuSpec = Task(
"GenerateNuSpec",
new GenerateNuGetSpecTask(nucpec)
.WithDependenciesFromPackagesConfig(projectDir);
Writing Tasks
- Creating a Workflow
- Defining Tasks
- Share State accross Tasks
- Mastering Dependencies
- Using result transformers
- Using Subflows to organize tasks
- Tasks Preconditions
- Recovering failure results
- Declaring dynamic tasks
- Creating Custom Tasks
Running Tasks
API
Tasklib