1

Closed

Make nuget-deploy optional

description

I build the katanaproject from a VS 2013 command prompt using:
    set Platform=AnyCPU
    set DevDivCodeAnalysisRunType=Disabled
    call build.cmd release deploy > build.txt 2>&1

Problem

The last step of the build process fails, uploading to NuGet. This is obvious, because I have no rights to publish katana packages.

So I modified build\Sakefile.shade to
var NUGET_DEPLOY=''
But this still results in an error:
info: Target nuget-deploy
info: Exec
info:   program: .nuget/NuGet.exe
info:   commandline: push "artifacts\Microsoft.Owin.3.0.1.nupkg"
info:   workingdir: c:\TFS\AgpWebEngine\Dependencies\KatanaProject-24aa43641ada
WARNING: No API Key was provided and no API Key could be found for the NuGet gallery (https://www.nuget.org). To save an API Key for a source use the 'setApiKey' command.
Pushing Microsoft.Owin 3.0.1 to the NuGet gallery (https://www.nuget.org)...
Please provide credentials for: https://www.nuget.org/api/v2/package/
UserName: Cannot prompt for input in non-interactive mode.
warn: Exit code 1 from .nuget/NuGet.exe

Solution

I modified build\Sakefile.shade to not upload if the NUGET_DEPLOY variable is empty
#nuget-deploy target='deploy' description='Upload NuGet packages to gallery'
  test if='!String.IsNullOrEmpty(NUGET_DEPLOY)'
    var extra=''
    set extra='${extra} -Source ${NUGET_DEPLOY}' if='!string.IsNullOrEmpty(NUGET_DEPLOY)'
    nuget-push each='var nupkgFile in Files.Include(Path.Combine(TARGET_DIR, "*.nupkg"))'

Build output after modification

After modification the build ends correctly, skipping the NuGet upload
info: Target integration-test
info: Target post-integration-test
info: Target verify
info: Target nuget-deploy
info: Target deploy

file attachments

Closed Mar 2 at 9:50 PM by mgirgin

comments

MircoBabin wrote Aug 14, 2015 at 12:06 PM

I have attached a patch with my modifications. I'm not very familiair with Git so I don't know if this is the desired format for receiving contributions.