public InvokeNugetProcess ( List |
||
arguments | List |
cmd line args to NuGet.exe |
workingDir | string | working dir if any to be used |
timeout | int | Timeout in seconds (default = 6min). |
return | Task |
private async Task <string> CreatePackageWithTargetFrameworkInternal(string nuspecFileFullPath, string frameworkVersion) { string nuspecDir = Path.GetDirectoryName(nuspecFileFullPath); AddContent(nuspecDir, frameworkVersion); AddLib(nuspecDir, frameworkVersion); var arguments = string.Join(string.Empty, CommandlineHelper.PackCommandString, @"""" + nuspecFileFullPath + @"""", CommandlineHelper.OutputDirectorySwitchString, @"""" + nuspecDir + @""""); var commandlineHelper = new CommandlineHelper(TestOutputHelper); await commandlineHelper.InvokeNugetProcess(arguments, Path.GetFullPath(Path.GetDirectoryName(nuspecFileFullPath))); string[] nupkgFiles = Directory.GetFiles(nuspecDir, "*.nupkg").ToArray(); return(nupkgFiles.Length == 0 ? null : nupkgFiles[0]); }
/// <summary> /// Creates a Nuspec file given the Package Name. /// </summary> /// <param name="packageName"></param> /// <param name="version"></param> /// <param name="minClientVersion"></param> /// <param name="title"></param> /// <param name="tags"></param> /// <param name="description"></param> /// <param name="licenseUrl"></param> /// <param name="dependencies"></param> /// <returns></returns> public async Task <string> CreateDefaultNuspecFile(string packageName, string version = "1.0.0", string minClientVersion = null, string title = null, string tags = null, string description = null, string licenseUrl = null, string dependencies = null) { string packageDir = Path.Combine(Environment.CurrentDirectory, packageName); if (Directory.Exists(packageDir)) { Directory.Delete(packageDir, true); } Directory.CreateDirectory(packageDir); var arguments = string.Join(string.Empty, CommandlineHelper.SpecCommandString, packageName); var commandlineHelper = new CommandlineHelper(TestOutputHelper); await commandlineHelper.InvokeNugetProcess(arguments, packageDir); string filePath = Path.Combine(packageDir, packageName + ".nuspec"); RemoveSampleNuspecValues(filePath); UpdateNuspecFile(filePath, "1.0.0", version); UpdateNuspecFile(filePath, "Package description", "This is a test package created by the NuGet team."); // Apply the minClientVersion to the spec only if it's defined. if (minClientVersion != null) { UpdateNuspecFile(filePath, "<metadata>", String.Format("<metadata minClientVersion=\"{0}\">", minClientVersion)); } if (title != null) { UpdateNuspecFile(filePath, "</metadata>", String.Format("<title>{0}</title></metadata>", title)); } if (tags != null) { UpdateNuspecFile(filePath, "Tag1 Tag2", tags); } if (description != null) { UpdateNuspecFile(filePath, "This is a test package created by the NuGet team.", description); } if (licenseUrl != null) { UpdateNuspecFile(filePath, "</metadata>", String.Format("<licenseUrl>{0}</licenseUrl></metadata>", licenseUrl)); } if (dependencies != null) { UpdateNuspecFile(filePath, "</dependencies>", String.Format("{0}</dependencies>", dependencies)); } return(filePath); }
/// <summary> /// Creates a Nuspec file given the Package Name. /// </summary> /// <param name="packageName"></param> /// <param name="version"></param> /// <param name="minClientVersion"></param> /// <param name="title"></param> /// <param name="tags"></param> /// <param name="description"></param> /// <param name="licenseUrl"></param> /// <param name="dependencies"></param> /// <returns></returns> public async Task<string> CreateDefaultNuspecFile(string packageName, string version = "1.0.0", string minClientVersion = null, string title = null, string tags = null, string description = null, string licenseUrl = null, string dependencies = null) { string packageDir = Path.Combine(Environment.CurrentDirectory, packageName); if (Directory.Exists(packageDir)) { Directory.Delete(packageDir, true); } Directory.CreateDirectory(packageDir); var arguments = string.Join(string.Empty, CommandlineHelper.SpecCommandString, packageName); var commandlineHelper = new CommandlineHelper(TestOutputHelper); await commandlineHelper.InvokeNugetProcess(arguments, packageDir); string filePath = Path.Combine(packageDir, packageName + ".nuspec"); RemoveSampleNuspecValues(filePath); UpdateNuspecFile(filePath, "1.0.0", version); UpdateNuspecFile(filePath, "Package description", "This is a test package created by the NuGet team."); // Apply the minClientVersion to the spec only if it's defined. if (minClientVersion != null) { UpdateNuspecFile(filePath, "<metadata>", String.Format("<metadata minClientVersion=\"{0}\">", minClientVersion)); } if (title != null) { UpdateNuspecFile(filePath, "</metadata>", String.Format("<title>{0}</title></metadata>", title)); } if (tags != null) { UpdateNuspecFile(filePath, "Tag1 Tag2", tags); } if (description != null) { UpdateNuspecFile(filePath, "This is a test package created by the NuGet team.", description); } if (licenseUrl != null) { UpdateNuspecFile(filePath, "</metadata>", String.Format("<licenseUrl>{0}</licenseUrl></metadata>", licenseUrl)); } if (dependencies != null) { UpdateNuspecFile(filePath, "</dependencies>", String.Format("{0}</dependencies>", dependencies)); } return filePath; }
private async Task<string> CreatePackageWithTargetFrameworkInternal(string nuspecFileFullPath, string frameworkVersion) { string nuspecDir = Path.GetDirectoryName(nuspecFileFullPath); AddContent(nuspecDir, frameworkVersion); AddLib(nuspecDir, frameworkVersion); var arguments = string.Join(string.Empty, CommandlineHelper.PackCommandString, @"""" + nuspecFileFullPath + @"""", CommandlineHelper.OutputDirectorySwitchString, @"""" + nuspecDir + @""""); var commandlineHelper = new CommandlineHelper(TestOutputHelper); await commandlineHelper.InvokeNugetProcess(arguments, Path.GetFullPath(Path.GetDirectoryName(nuspecFileFullPath))); string[] nupkgFiles = Directory.GetFiles(nuspecDir, "*.nupkg").ToArray(); return nupkgFiles.Length == 0 ? null : nupkgFiles[0]; }