A measurement of W-gamma and Z-gamma production in proton-proton collisions at sqrt(s) = 7 TeV is presented. Results are based on a data sample recorded by the CMS experiment at the LHC, corresponding to an integrated luminosity of 36 inverse picobarns. The electron and muon decay channels of the W and Z are used. The total cross sections are measured for photon transverse energy >10 GeV and spatial separation from charged leptons in the plane of pseudorapidity and azimuthal angle >0.7, and with an additional dilepton invariant mass requirement of > 50 GeV for the Z-gamma process. The following cross section times branching fraction values are found: sigma(pp to W-gamma+X) B(W to lepton neutrino) = 56.3 +/- 5.0 (stat.) +/- 5.0 (syst.) +/- 2.3 (lumi.) pb and sigma(pp to Z-gamma+X) B}(Z to lepton lepton) = 9.4 +/- 1.0 (stat.) +/- 0.6 (syst.) +/- 0.4 (lumi.) pb. These measurements are in agreement with standard model predictions. The first limits on anomalous WW gamma, ZZ gamma, and Z gamma gamma trilinear gauge couplings at sqrt(s) = 7 TeV are set.