Add an -o parameter, allowing you to store the package in a specific folder

This commit is contained in:
Frederik Carlier
2019-11-22 13:36:55 +01:00
parent a027792a6a
commit 0816fac08e
4 changed files with 29 additions and 8 deletions

View File

@@ -86,9 +86,9 @@ stages:
# Install and use dotnet $(command)
dotnet $(command) install
dotnet $(command)
dotnet $(command) -o $(Build.ArtifactStagingDirectory)/packages/$(container)
workingDirectory: $(Pipeline.Workspace)
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Pipeline.Workspace)/test-$(command)/bin/Debug/
artifactName: artifacts
pathToPublish: $(Build.ArtifactStagingDirectory)/packages/
artifactName: packages

View File

@@ -14,7 +14,8 @@
<PackagePrefix Condition="'$(PackagePrefix)' == ''">$(TargetName)</PackagePrefix>
<PackageName Condition="'$(PackageName)' == ''">$(PackagePrefix).$(PackageVersion).$(RuntimeIdentifier)</PackageName>
<IntermediatePackagePath>$(IntermediateOutputPath)$(PackageName)</IntermediatePackagePath>
<PackagePath Condition="'$(PackagePath)' == ''">$(TargetDir)$(PackageName)</PackagePath>
<PackageDir Condition="'$(PackageDir)' == ''">(TargetDir)</PackageDir>
<PackagePath Condition="'$(PackagePath)' == ''">$([MSBuild]::EnsureTrailingSlash($(PackageDir)))$(PackageName)</PackagePath>
<CreateUser Condition="'$(CreateUser)' == ''">false</CreateUser>
<InstallService Condition="'$(InstallService)' == ''">false</InstallService>
<PackageMaintainer Condition="'$(PackageMaintainer)' == '' AND '$(Authors)' != ''">$(Authors)</PackageMaintainer>
@@ -41,6 +42,8 @@
<Message Text="Creating RPM package $(RpmPath)" Importance="high"/>
<MakeDir Directories="$(PackageDir)"/>
<RpmTask PublishDir="$(PublishDir)"
RpmPath="$(RpmPath)"
CpioPath="$(CpioPath)"
@@ -99,6 +102,8 @@
<DebDotNetDependencies Include="zlib1g"/>
<DebDotNetDependencies Include="libicu52 | libicu53 | libicu54 | libicu55 | libicu56 | libicu57 | libicu58 | libicu59 | libicu60 | libicu61 | libicu62 | libicu63"/>
</ItemGroup>
<MakeDir Directories="$(PackageDir)"/>
<DebTask PublishDir="$(PublishDir)"
DebPath="$(DebPath)"
@@ -135,6 +140,8 @@
<Message Text="Creating tarball $(TarballPath)" Importance="high"/>
<MakeDir Directories="$(PackageDir)"/>
<TarballTask PublishDir="$(PublishDir)"
TarballPath="$(TarballPath)"/>
</Target>
@@ -146,6 +153,8 @@
<Message Text="Creating zip package $(ZipPath)" Importance="high"/>
<MakeDir Directories="$(PackageDir)"/>
<ZipTask PublishDir="$(PublishDir)"
ZipPath="$(ZipPath)"/>
</Target>

View File

@@ -46,10 +46,12 @@ From the command line, run `dotnet rpm`, `dotnet zip` or `dotnet tarball` to cre
All commands take the following command line arguments:
* `-r`, `--runtime`: Required. The target runtime has to be specified in the project file. For example, `win7-x64` or `ubuntu.16.10-x64`.
* `-f`, `--framework`: Required. The target framework has to be specified in the project file. For example, `netcoreapp1.1` or `net462`.
* `-r`, `--runtime`: The target runtime to build your project for. For example, `win7-x64` or `ubuntu.16.10-x64`.
* `-f`, `--framework`: The target framework to build your project for. For example, `netcoreapp1.1` or `net462`.
* `-c`, `--configuration`: Target configuration. The default for most projects is 'Debug'.
* `-o`, `--output`: The output directory to place built packages in.
* `---version-suffix`: Defines the value for the `$(VersionSuffix)` property in the project.
* `--no-restore`: Skip the implicit call to `dotnet restore`.
All arguments are optional.

View File

@@ -40,12 +40,17 @@ namespace Dotnet.Packaging
CommandOption framework = commandLineApplication.Option(
"-f | --framework <framework>",
$"Required. Target framework of the {outputName}. The target framework has to be specified in the project file.",
$"Target framework of the {outputName}. The target framework has to be specified in the project file.",
CommandOptionType.SingleValue);
CommandOption configuration = commandLineApplication.Option(
"-c | --configuration <configuration>",
$"Required. Target configuration of the {outputName}. The default for most projects is 'Debug'.",
$"Target configuration of the {outputName}. The default for most projects is 'Debug'.",
CommandOptionType.SingleValue);
CommandOption output = commandLineApplication.Option(
"-o | --output <output-dir>",
$"The output directory to place built packages in. The default is the output directory of your project.",
CommandOptionType.SingleValue);
CommandOption versionSuffix = commandLineApplication.Option(
@@ -138,6 +143,11 @@ namespace Dotnet.Packaging
msbuildArguments.Append($"/p:VersionSuffix={versionSuffix.Value()} ");
}
if (output.HasValue())
{
msbuildArguments.Append($"/p:PackageDir={output.Value()} ");
}
return RunDotnet(msbuildArguments);
});