예제 #1
0
        public static Publisher AddNuGetPackage(this IList <Publisher> publishers, string projectFile,
                                                Func <string, string> sourceFn = null,
                                                Func <string, string> apiKeyFn = null,
                                                bool publishAsSnupkg           = false)
        {
            var publisher = new NuGetPublisher(projectFile)
            {
                Source          = sourceFn,
                ApiKey          = apiKeyFn,
                PublishAsSnupkg = publishAsSnupkg,
            };

            publishers.Add(publisher);
            return(publisher);
        }
예제 #2
0
        /// <summary>
        ///     Publishes the specified project as a NuGet package.
        /// </summary>
        /// <param name="publishers">The publishers collection.</param>
        /// <param name="projectFile">The .NET project file to publish.</param>
        /// <param name="source">The NuGet source feed URL to publish to.</param>
        /// <param name="apiKey">Optional API key to the NuGet source feed.</param>
        /// <param name="publishAsSnupkg">True to publish the package using the new SNUPKG format.</param>
        /// <returns>The instance of the created <see cref="Publisher"/> class.</returns>
        public static Publisher AddNuGetPackage(this IList <Publisher> publishers, string projectFile,
                                                string source        = null,
                                                string apiKey        = null,
                                                bool publishAsSnupkg = false)
        {
            var publisher = new NuGetPublisher(projectFile)
            {
                PublishAsSnupkg = publishAsSnupkg,
            };

            if (source != null)
            {
                publisher.Source = _ => source;
            }
            if (apiKey != null)
            {
                publisher.ApiKey = _ => apiKey;
            }
            publishers.Add(publisher);
            return(publisher);
        }