Using RgPublish.exe
Published 07 August 2013
To create application packages and publish them to a package feed, you can use the RgPublish.exe command line interface.
How to download RgPublish.exe:
- In the Deployment Manager web interface, on the menu bar, click Tools:
- Under RgPublish.exe, click Download:
If you installed Deployment Manager to the default location, you can find RgPublish.exe in:
C:\Program Files (x86)\Red Gate\Deployment Manager\Tools
.NET Framework 4.0
Machines running RgPublish.exe require Microsoft .NET Framework 4.0. You can download the framework here.
Example: publishing from a Visual Studio project file (.csproj)
In the following example:
- the project we want to publish is MyWebApp.csproj
- we want to publish to our Deployment Manager package feed at http://localhost:8080/nuget/
To publish the project, at the command prompt, we navigate to the location of RgPublish.exe and run:
RgPublish /source="C:\Source Code\My Web App\MyWebApp.csproj" /Configuration=Debug /Platform=x86 /target=feed:http://localhost:8080/nuget/
This creates a package MyWebApp-1.0.nupkg, and pushes it to the package feed. You can now use Deployment Manager to deploy this package.
Example: publishing a directory
In the following example:
the required files for the application we want to package are in C:\Source Code\My Web App\
For information about what packages should contain, and how to structure the directory you want to publish, see Working with packages.- we want to publish to our Deployment Manager package feed at http://localhost:8080/nuget/
To publish the directory, at the command prompt, we navigate to the location of RgPublish.exe and run:
RgPublish /source="C:\Source Code\My Web App" /version=1.0 /packageid=MyWebApp /target=feed:http://localhost:8080/nuget/
This creates a package MyWebApp-1.0.nupkg, and pushes it to the package feed. You can now use Deployment Manager to deploy this package.
Example: publishing from a .nuspec file
In the following example:
the package.nuspec file describes the package we want to create
For information about .nuspec files, see Nuspec reference (NuGet documentation)
- the file paths defined in package.nuspec are relative to the base directory C:/Source Code/
- we want to publish to a package feed at http://server:80/nuget, using the feed API key apikey1
To publish the package, at the command prompt, we navigate to the location of RgPublish.exe and run:
RgPublish /source="C:\Source Code\My Web App\package.nuspec" /basedir="C:\Source Code" /target=feed:http://server:80/nuget /apikey=apikey1
This creates a package Widget_Shop-1.0.0.nupkg, and pushes it to the package feed. You can now use Deployment Manager to deploy this package.
RgPublish.exe syntax
Source
/source=<path>
Alias: /s
Path to a .csproj file, .nuspec file or a directory to publish. For example:
/source="C:\My Project\MyWebApp.csproj"
or
/source="C:\My Project\packages.nuspec"
or
/source="C:\My Project"
Package details
You can specify details of the package using the following commands:
/packageid=<package name>
Alias: /id
Name of the package. For example:
/packageid=Widget_Shop
If you don’t specify /packageid
(or <id>
in a .nuspec file), the directory name is used as the package name.
/version=<version number>
Alias: /v or /packageversion
Version number for the package. For example:
/version=1.0
/description=<description>
A description of the package contents. For example:
/description="web interface"
If you don’t specify /description
(or <description>
in a .nuspec file), Published by Red Gate Publishing Tool is used as the description.
/author=<author name>
Author of the package. For example:
/author=RedGate
If you don’t specify /author
(or <authors>
in a .nuspec file), the current Windows user is used as the author name.
/basedir=<directory path>
Base directory where files defined in a .nuspec file are located (the directory against which paths in <files> are resolved). For example:
/basedir="C:\Source Code"
If the source is a .nuspec file and you don’t specify /basedir
, the directory where the .nuspec file is located is used as the base directory.
Web application (.csproj) commands
If you're publishing a web application from a .csproj file, you can specify the following commands:
/configuration=<project configuration>
The project configuration to use when the project is built. For example:
/configuration=Debug
If you don't specify /configuration
, the Release configuration is used.
/platform=<project platform>
The project platform to use when the project is built. For example:
/platform=x86
If you don't specify /platform
, the platform defined in the project is used.
/buildDir=<directory path>
The directory where the web application will be built before packaging. For example:
/buildDir=C:\Builds
If you don’t specify /baseDir
, a random temporary directory will be used and deleted after publishing.
/clean
Alias: /c
If you specify /buildDir
, this argument deletes the contents of the directory before building the project.
Publishing to a directory
By default, packages are published to the working directory. You publish the package to a different directory using the following commands:
/target=<directory path>
Alias: /t
Path to a directory to publish to. For example:
/target=C:\Packages
/overwrite
Overwrites an existing package with the same name and version number.
If a package with the same name and version as you want to publish exists in the target directory and you don't specify /overwrite
, package publishing will fail.
Publishing to a package feed
You can publish the package to a package feed using the following commands:
/target=feed:<package feed URL>
Alias: /t
URL of a package feed to publish to. For example:
/target=feed:http://localhost:8080/nuget/
If you publish to a package feed that requires an API key, specify:
/apikey=<feed API key>
API key for the package feed to publish to. For example:
/apikey=apikey1
/timeout=<time>
The maximum time that RgPublish.exe will try to connect to a NuGet package feed. Specify a time value in the format hh:mm:ss. For example:
/timeout=00:10:00
If you don't specify /timeout
, the default value 00:00:30 (thirty seconds) is used.
Miscellaneous commands
/verbose
Writes more detailed logging information to the command line. We recommend you save verbose logging information to a file.