Ejemplo n.º 1
0
        protected internal override IPackagePushLocation GetPushLocation()
        {
            if (ServerPath == null)
            {
                ServerPath = new Uri("https://nuget.org");
            }
            PackageServer server = new PackageServer(ServerPath.ToString(), "NAnt.NuGet");
            string        apiKey = ApiKey;

            if (apiKey == null && ApiKeyFile != null)
            {
                if (!ApiKeyFile.Exists)
                {
                    throw new BuildException(String.Format("Api key-file '{0}' does not exist.", ApiKeyFile.FullName));
                }
                apiKey = File.ReadAllText(ApiKeyFile.FullName);
            }

            return(new ServerPushLocation(apiKey, server));
        }