public void Report()
{
if (String.IsNullOrEmpty(PackageId))
throw new InvalidOperationException("Package ID is not specified.");
if (String.IsNullOrEmpty(ProjectName))
throw new InvalidOperationException(
String.Format("Project name is missing for package '{0}'.", PackageId));
if (String.IsNullOrEmpty(ProjectUrl))
throw new InvalidOperationException(
String.Format("Project URL is missing for package '{0}'.", PackageId));
if (BuildVersion == null)
throw new InvalidOperationException(
String.Format("Build version is missing for package '{0}'.", PackageId));
if (IsDependency && IsBundle)
throw new InvalidOperationException(
String.Format("Both dependency and bundle cannot be specified for package '{0}'.", PackageId));
string source;
if (SourceVersion == null)
{
source = "n/a";
}
else
{
source = SourceVersion.Normalize().ToString();
}
var build = BuildVersion.Normalize().ToString();
if (ProjectReference)
{
source = source + " (csproj)";
}
Execute.ReportPackage(ProjectName, ProjectUrl, source, build, Comment);
}
}